# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
362959 | 2021-02-04T23:27:43 Z | Kenzo_1114 | Nautilus (BOI19_nautilus) | C++17 | 223 ms | 748 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN = 510; int n, m, q; char cur; bitset<MAXN> dp[2][MAXN], base[MAXN]; int main () { scanf("%d %d %d", &n, &m, &q); for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) { scanf(" %c", &cur); dp[0][i][j] = base[i][j] = (cur == '.'); } for(int K = 1, k; K <= q; K++) { k = K & 1; scanf(" %c", &cur); for(int i = 1; i <= n; i++) { if(cur == 'N') dp[k][i] = dp[!k][i + 1]; if(cur == 'E') dp[k][i] = dp[!k][i] << 1; if(cur == 'S') dp[k][i] = dp[!k][i - 1]; if(cur == 'W') dp[k][i] = dp[!k][i] >> 1; if(cur == '?') dp[k][i] = dp[!k][i + 1] | (dp[!k][i] >> 1) | dp[!k][i - 1] | (dp[!k][i] << 1); dp[k][i] &= base[i]; } } int ans = 0; for(int i = 1; i <= n; i++) ans += dp[q & 1][i].count(); printf("%d\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 2 ms | 364 KB | Output is correct |
10 | Correct | 2 ms | 364 KB | Output is correct |
11 | Correct | 2 ms | 364 KB | Output is correct |
12 | Correct | 2 ms | 364 KB | Output is correct |
13 | Correct | 2 ms | 364 KB | Output is correct |
14 | Correct | 2 ms | 364 KB | Output is correct |
15 | Correct | 2 ms | 512 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 364 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 364 KB | Output is correct |
20 | Correct | 2 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 2 ms | 364 KB | Output is correct |
10 | Correct | 2 ms | 364 KB | Output is correct |
11 | Correct | 2 ms | 364 KB | Output is correct |
12 | Correct | 2 ms | 364 KB | Output is correct |
13 | Correct | 2 ms | 364 KB | Output is correct |
14 | Correct | 2 ms | 364 KB | Output is correct |
15 | Correct | 2 ms | 512 KB | Output is correct |
16 | Correct | 2 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 364 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 364 KB | Output is correct |
20 | Correct | 2 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 98 ms | 716 KB | Output is correct |
23 | Correct | 99 ms | 620 KB | Output is correct |
24 | Correct | 98 ms | 620 KB | Output is correct |
25 | Correct | 95 ms | 640 KB | Output is correct |
26 | Correct | 93 ms | 748 KB | Output is correct |
27 | Correct | 166 ms | 716 KB | Output is correct |
28 | Correct | 167 ms | 620 KB | Output is correct |
29 | Correct | 167 ms | 748 KB | Output is correct |
30 | Correct | 166 ms | 716 KB | Output is correct |
31 | Correct | 163 ms | 620 KB | Output is correct |
32 | Correct | 217 ms | 748 KB | Output is correct |
33 | Correct | 222 ms | 748 KB | Output is correct |
34 | Correct | 215 ms | 620 KB | Output is correct |
35 | Correct | 217 ms | 620 KB | Output is correct |
36 | Correct | 223 ms | 748 KB | Output is correct |