# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
529706 | 2022-02-23T13:57:36 Z | c28dnv9q3 | Nautilus (BOI19_nautilus) | C++17 | 1000 ms | 1228 KB |
#include <cstdio> #include <iostream> const int N_MAX = 505; const int M_MAX = 5005; int R, C, M; bool map[N_MAX][N_MAX]; bool cur[2][N_MAX][N_MAX]; void printcur(int k) { for (int i = 0; i <= R + 1; i++) { for (int j = 0; j <= C + 1; j++) { putchar(cur[k][i][j] ? '#' : '.'); } putchar('\n'); } putchar('\n'); } int main() { std::cin >> R >> C >> M; for (int i = 0; i < R; i++) { std::string s; std::cin >> s; for (int j = 0; j < C; j++) { map[i+1][j+1] = s[j] == '.'; } } /*for (int i = 0; i < R + 2; i++) { map[i][0] = false; map[i][C+1] = false; } for (int j = 0; j < C + 2; j++) { map[0][j] = false; map[R+1][j] = false; }*/ int k = 0; for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { cur[k][i][j] = map[i][j]; } } //printf("Map at beginning\n"); //printcur(k); std::string instr; std::cin >> instr; for (int i = 0; i < instr.size(); i++) { char c = instr[i]; k = 1-k; //printf("INSTRUCTION %c (k=%d)\n", c, k); switch (c) { case 'N': for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { cur[k][i][j] = cur[1-k][i+1][j] && map[i][j]; } } break; case 'E': for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { cur[k][i][j] = cur[1-k][i][j-1] && map[i][j]; } } break; case 'S': for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { cur[k][i][j] = cur[1-k][i-1][j] && map[i][j]; } } break; case 'W': for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { cur[k][i][j] = cur[1-k][i][j+1] && map[i][j]; } } break; case '?': for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { cur[k][i][j] = ( cur[1-k][i-1][j] || cur[1-k][i+1][j] || cur[1-k][i][j-1] || cur[1-k][i][j+1] ) && map[i][j]; } } break; } //printcur(k); } int num = 0; for (int i = 1; i <= R; i++) { for (int j = 1; j <= C; j++) { num += cur[k][i][j] ? 1 : 0; } } std::cout << num << std::endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 332 KB | Output is correct |
6 | Correct | 2 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 332 KB | Output is correct |
6 | Correct | 2 ms | 332 KB | Output is correct |
7 | Correct | 2 ms | 332 KB | Output is correct |
8 | Correct | 5 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 332 KB | Output is correct |
13 | Correct | 5 ms | 332 KB | Output is correct |
14 | Correct | 7 ms | 448 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 2 ms | 332 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 4 ms | 332 KB | Output is correct |
19 | Correct | 7 ms | 332 KB | Output is correct |
20 | Correct | 4 ms | 448 KB | Output is correct |
21 | Correct | 3 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 2 ms | 332 KB | Output is correct |
3 | Correct | 2 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 332 KB | Output is correct |
5 | Correct | 2 ms | 332 KB | Output is correct |
6 | Correct | 2 ms | 332 KB | Output is correct |
7 | Correct | 2 ms | 332 KB | Output is correct |
8 | Correct | 5 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 332 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 332 KB | Output is correct |
13 | Correct | 5 ms | 332 KB | Output is correct |
14 | Correct | 7 ms | 448 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 2 ms | 332 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 4 ms | 332 KB | Output is correct |
19 | Correct | 7 ms | 332 KB | Output is correct |
20 | Correct | 4 ms | 448 KB | Output is correct |
21 | Correct | 3 ms | 332 KB | Output is correct |
22 | Correct | 882 ms | 1092 KB | Output is correct |
23 | Execution timed out | 1086 ms | 1228 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |