Submission #888066

# Submission time Handle Problem Language Result Execution time Memory
888066 2023-12-15T22:02:19 Z vjudge1 Nautilus (BOI19_nautilus) C++17
100 / 100
112 ms 856 KB
#include<bits/stdc++.h>
using namespace std;
bitset<512> tmp[502],grd[502],pos[502];
int main() {
    int r, c, m;
    cin >> r >> c >> m;
    for(int i = 1; i <= r; i++) {
        for(int j = 1; j <= c; j++) {
            char c = getchar();
            if(j==1)
                c=getchar();
            grd[i][j]=(c=='.');
        }
        pos[i]=grd[i];
    }
    for(int i = 0; i < m; i++) {
        char c = getchar();
        if(!i) c=getchar();
        for(int j = 1; j <= r; j++)
            tmp[j]=pos[j], pos[j].reset();
        for(int j = 1; j <= r; j++) {
            if(c=='N'||c=='?')
                pos[j]|=tmp[j+1];
            if(c=='S'||c=='?')
                pos[j]|=tmp[j-1];
            if(c=='E'||c=='?')
                pos[j]|=tmp[j]<<1;
            if(c=='W'||c=='?')
                pos[j]|=tmp[j]>>1;
            pos[j]&=grd[j];
        }
    }
    int ans = 0;
    for(int i = 1; i <= r; i++)
        ans+=pos[i].count();
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 77 ms 604 KB Output is correct
23 Correct 65 ms 604 KB Output is correct
24 Correct 65 ms 600 KB Output is correct
25 Correct 65 ms 604 KB Output is correct
26 Correct 63 ms 600 KB Output is correct
27 Correct 89 ms 752 KB Output is correct
28 Correct 92 ms 600 KB Output is correct
29 Correct 90 ms 752 KB Output is correct
30 Correct 90 ms 768 KB Output is correct
31 Correct 92 ms 604 KB Output is correct
32 Correct 112 ms 604 KB Output is correct
33 Correct 108 ms 600 KB Output is correct
34 Correct 110 ms 756 KB Output is correct
35 Correct 109 ms 604 KB Output is correct
36 Correct 109 ms 856 KB Output is correct