# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
260322 | 2020-08-10T05:21:10 Z | arnold518 | Nautilus (BOI19_nautilus) | C++14 | 260 ms | 157816 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 500; const int MAXM = 5000; int R, C, M; char S[MAXN+10][MAXN+10]; char A[MAXM+10]; bitset<501> B[MAXN+10]; bitset<501> D[MAXN+10][MAXM+10]; int main() { scanf("%d%d%d", &R, &C, &M); for(int i=1; i<=R; i++) scanf("%s", S[i]+1); scanf("%s", A+1); for(int i=1; i<=R; i++) for(int j=1; j<=C; j++) if(S[i][j]=='.') B[i][j-1]=1; for(int i=1; i<=R; i++) D[i][0]=B[i]; for(int p=1; p<=M; p++) { if(A[p]=='N' || A[p]=='?') { for(int i=1; i<R; i++) { D[i][p]|=D[i+1][p-1]; } } if(A[p]=='S' || A[p]=='?') { for(int i=2; i<=R; i++) { D[i][p]|=D[i-1][p-1]; } } if(A[p]=='E' || A[p]=='?') { for(int i=1; i<=R; i++) { D[i][p]|=D[i][p-1]<<1; } } if(A[p]=='W' || A[p]=='?') { for(int i=1; i<=R; i++) { D[i][p]|=D[i][p-1]>>1; } } for(int i=1; i<=R; i++) D[i][p]&=B[i]; } int ans=0; for(int i=1; i<=R; i++) ans+=D[i][M].count(); printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1408 KB | Output is correct |
2 | Correct | 1 ms | 1408 KB | Output is correct |
3 | Correct | 1 ms | 1408 KB | Output is correct |
4 | Correct | 1 ms | 1568 KB | Output is correct |
5 | Correct | 1 ms | 1536 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1408 KB | Output is correct |
2 | Correct | 1 ms | 1408 KB | Output is correct |
3 | Correct | 1 ms | 1408 KB | Output is correct |
4 | Correct | 1 ms | 1568 KB | Output is correct |
5 | Correct | 1 ms | 1536 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
7 | Correct | 2 ms | 1408 KB | Output is correct |
8 | Correct | 2 ms | 1536 KB | Output is correct |
9 | Correct | 2 ms | 1408 KB | Output is correct |
10 | Correct | 1 ms | 1408 KB | Output is correct |
11 | Correct | 2 ms | 1536 KB | Output is correct |
12 | Correct | 2 ms | 1536 KB | Output is correct |
13 | Correct | 2 ms | 1408 KB | Output is correct |
14 | Correct | 2 ms | 1536 KB | Output is correct |
15 | Correct | 2 ms | 1408 KB | Output is correct |
16 | Correct | 2 ms | 1536 KB | Output is correct |
17 | Correct | 2 ms | 1408 KB | Output is correct |
18 | Correct | 2 ms | 1408 KB | Output is correct |
19 | Correct | 2 ms | 1408 KB | Output is correct |
20 | Correct | 2 ms | 1536 KB | Output is correct |
21 | Correct | 2 ms | 1408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1408 KB | Output is correct |
2 | Correct | 1 ms | 1408 KB | Output is correct |
3 | Correct | 1 ms | 1408 KB | Output is correct |
4 | Correct | 1 ms | 1568 KB | Output is correct |
5 | Correct | 1 ms | 1536 KB | Output is correct |
6 | Correct | 1 ms | 1408 KB | Output is correct |
7 | Correct | 2 ms | 1408 KB | Output is correct |
8 | Correct | 2 ms | 1536 KB | Output is correct |
9 | Correct | 2 ms | 1408 KB | Output is correct |
10 | Correct | 1 ms | 1408 KB | Output is correct |
11 | Correct | 2 ms | 1536 KB | Output is correct |
12 | Correct | 2 ms | 1536 KB | Output is correct |
13 | Correct | 2 ms | 1408 KB | Output is correct |
14 | Correct | 2 ms | 1536 KB | Output is correct |
15 | Correct | 2 ms | 1408 KB | Output is correct |
16 | Correct | 2 ms | 1536 KB | Output is correct |
17 | Correct | 2 ms | 1408 KB | Output is correct |
18 | Correct | 2 ms | 1408 KB | Output is correct |
19 | Correct | 2 ms | 1408 KB | Output is correct |
20 | Correct | 2 ms | 1536 KB | Output is correct |
21 | Correct | 2 ms | 1408 KB | Output is correct |
22 | Correct | 183 ms | 157432 KB | Output is correct |
23 | Correct | 185 ms | 157560 KB | Output is correct |
24 | Correct | 213 ms | 157452 KB | Output is correct |
25 | Correct | 216 ms | 157432 KB | Output is correct |
26 | Correct | 204 ms | 157560 KB | Output is correct |
27 | Correct | 247 ms | 157432 KB | Output is correct |
28 | Correct | 229 ms | 157688 KB | Output is correct |
29 | Correct | 225 ms | 157816 KB | Output is correct |
30 | Correct | 224 ms | 157688 KB | Output is correct |
31 | Correct | 223 ms | 157816 KB | Output is correct |
32 | Correct | 260 ms | 157688 KB | Output is correct |
33 | Correct | 258 ms | 157688 KB | Output is correct |
34 | Correct | 259 ms | 157676 KB | Output is correct |
35 | Correct | 259 ms | 157816 KB | Output is correct |
36 | Correct | 260 ms | 157816 KB | Output is correct |