| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 15 초 | 2048 MB | 10 | 7 | 7 | 87.500% |
It is the 25th of December, 2025. As a Christmas tradition, you gather a group of friends to solve a puzzle. Among your friends are wordcels and shape rotators, who are respectively better at thinking with words and with mental images. This puzzle challenges even the smartest wordcel and the most brilliant shape rotator:
There is a $3$-dimensional grid with points at all integer coordinates $(x,y,z)$ with $1\leq x,y,z\leq n$, and each point has a label associated with it, which is either 'B', 'A', 'P', or 'C'. In this grid, you need to find occurrences of the curly word "BAPC". A curly word "BAPC" is a collection of four points in the grid such that:
BAPC" (in this order).BAP" makes is $90$ degrees: the vectors from B $\to$ A and from A $\to$ P form a $90$-degree angle.APC" makes is $90$ degrees: the vectors from A $\to$ P and from P $\to$ C form a $90$-degree angle.Note that the two angles do not need to be axis-aligned. As an example, see the third sample case, visualized in Figure L.1.
How many occurrences of the curly word "BAPC" are in the given grid?
The input consists of:
-), to make the input more human-readable.B', 'A', 'P', or 'C', representing all labels of one horizontal layer of the $3$-dimensional grid.Output the number of curly words "BAPC" in the $3$-dimensional grid.
1 - B
0
2 - PA PB - CC PB
2
3 - BBB BCB BCB - BBC CBA BBB - BBB BPB BBB
2
Figure L.1: Visualization of the third sample input. In this grid, there are two curly words "BAPC", using the highlighted letters.
ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2025 L번