# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419882 | 2021-06-07T15:38:19 Z | nicolaalexandra | Nautilus (BOI19_nautilus) | C++14 | 178 ms | 716 KB |
#include <bits/stdc++.h> #define DIM 510 using namespace std; char v[DIM*10],s[DIM]; int n,m,k,i,j; bitset <DIM> a[2][DIM],mask[DIM]; int main (){ //ifstream cin ("date.in"); //ofstream cout ("date.out"); cin>>n>>m>>k; for (i=1;i<=n;i++){ cin>>s+1; for (j=1;j<=m;j++) if (s[j] == '.') mask[i][j] = 1; a[0][i] = mask[i]; } cin>>v+1; int t = 1; for (int pas=1;pas<=k;pas++){ for (i=1;i<=n;i++) a[t][i].reset(); for (i=1;i<=n;i++){ if (v[pas] == 'N' || v[pas] == '?') a[t][i] |= a[1-t][i+1]; if (v[pas] == 'S' || v[pas] == '?') a[t][i] |= a[1-t][i-1]; if (v[pas] == 'E' || v[pas] == '?') a[t][i] |= (a[1-t][i] << 1); if (v[pas] == 'W' || v[pas] == '?') a[t][i] |= (a[1-t][i] >> 1); a[t][i] &= mask[i]; } t = 1-t; } int sol = 0; for (i=1;i<=n;i++) for (j=1;j<=m;j++) sol += a[1-t][i][j]; cout<<sol; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 308 KB | Output is correct |
14 | Correct | 2 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 2 ms | 332 KB | Output is correct |
19 | Correct | 2 ms | 204 KB | Output is correct |
20 | Correct | 2 ms | 204 KB | Output is correct |
21 | Correct | 2 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 308 KB | Output is correct |
14 | Correct | 2 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 2 ms | 332 KB | Output is correct |
18 | Correct | 2 ms | 332 KB | Output is correct |
19 | Correct | 2 ms | 204 KB | Output is correct |
20 | Correct | 2 ms | 204 KB | Output is correct |
21 | Correct | 2 ms | 332 KB | Output is correct |
22 | Correct | 102 ms | 620 KB | Output is correct |
23 | Correct | 109 ms | 620 KB | Output is correct |
24 | Correct | 103 ms | 632 KB | Output is correct |
25 | Correct | 102 ms | 624 KB | Output is correct |
26 | Correct | 103 ms | 584 KB | Output is correct |
27 | Correct | 144 ms | 616 KB | Output is correct |
28 | Correct | 152 ms | 620 KB | Output is correct |
29 | Correct | 143 ms | 588 KB | Output is correct |
30 | Correct | 142 ms | 620 KB | Output is correct |
31 | Correct | 153 ms | 600 KB | Output is correct |
32 | Correct | 176 ms | 620 KB | Output is correct |
33 | Correct | 178 ms | 588 KB | Output is correct |
34 | Correct | 173 ms | 588 KB | Output is correct |
35 | Correct | 178 ms | 716 KB | Output is correct |
36 | Correct | 169 ms | 584 KB | Output is correct |