# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227010 | 2020-04-25T20:54:26 Z | luciocf | Nautilus (BOI19_nautilus) | C++14 | 255 ms | 1016 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 510; const int maxm = 5e3+10; bitset<maxn> bs[maxn], ant[maxn], mark[maxn]; char tab[maxn][maxn]; char s[maxm]; int main(void) { int a, b, m; scanf("%d %d %d", &a, &b, &m); for (int i = 1; i <= a; i++) { for (int j = 1; j <= b; j++) { scanf(" %c", &tab[i][j]); if (tab[i][j] == '.') { mark[i][b-j+1] = 1; ant[i][b-j+1] = 1; } } } for (int i = 1; i <= m; i++) scanf(" %c", &s[i]); for (int p = 1; p <= m; p++) { for (int i = 1; i <= a; i++) { if (s[p] == 'N') { bs[i] = (ant[i+1] & mark[i]); } else if (s[p] == 'E') { bs[i] = ((ant[i] >> 1) & mark[i]); } else if (s[p] == 'S') { bs[i] = (ant[i-1] & mark[i]); } else if (s[p] == 'W') { bs[i] = ((ant[i] << 1) & mark[i]); } else { bs[i] = ((ant[i+1] | ant[i-1] | (ant[i] >> 1) | (ant[i] << 1)) & mark[i]); } } if (p != m) for (int i = 1; i <= a; i++) swap(bs[i], ant[i]); } int ans = 0; for (int i = 1; i <= a; i++) ans += bs[i].count(); printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 512 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 512 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 6 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 6 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 6 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 6 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 512 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 6 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 6 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 384 KB | Output is correct |
12 | Correct | 6 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 6 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 128 ms | 712 KB | Output is correct |
23 | Correct | 128 ms | 896 KB | Output is correct |
24 | Correct | 128 ms | 896 KB | Output is correct |
25 | Correct | 126 ms | 996 KB | Output is correct |
26 | Correct | 125 ms | 896 KB | Output is correct |
27 | Correct | 195 ms | 992 KB | Output is correct |
28 | Correct | 196 ms | 1016 KB | Output is correct |
29 | Correct | 194 ms | 964 KB | Output is correct |
30 | Correct | 196 ms | 972 KB | Output is correct |
31 | Correct | 195 ms | 896 KB | Output is correct |
32 | Correct | 255 ms | 896 KB | Output is correct |
33 | Correct | 245 ms | 896 KB | Output is correct |
34 | Correct | 249 ms | 1016 KB | Output is correct |
35 | Correct | 252 ms | 1016 KB | Output is correct |
36 | Correct | 246 ms | 896 KB | Output is correct |