# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314126 | 2020-10-18T15:22:53 Z | kimbj0709 | Nautilus (BOI19_nautilus) | C++14 | 199 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 505; int32_t main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); bitset<maxn> dp[maxn][2]; bitset<maxn> arr[maxn]; int n,m,len; cin >> n >> m >> len; string input; char inp; for(int i=1;i<=n;i++){ cin >> input; for(int j=1;j<=m;j++){ if(input.at(j-1)=='.'){ arr[i][j] = 1; } } dp[i][0] = arr[i]; } cin >> input; for(int i=0;i<len;i++){ for(int a=1;a<=n;a++){ if(input.at(i)=='N'){ dp[a][(i+1)&1] = dp[a+1][i&1]; } if(input.at(i)=='S'){ dp[a][(i+1)&1] = dp[a-1][i&1]; } if(input.at(i)=='W'){ dp[a][(i+1)&1] = dp[a][i&1] >> 1; } if(input.at(i)=='E'){ dp[a][(i+1)&1] = dp[a][i&1] << 1; } if(input.at(i)=='?'){ dp[a][(i+1)&1] = (dp[a][i&1] << 1)|(dp[a][i&1] >> 1)|(dp[a-1][i&1])|(dp[a+1][i&1]); } dp[a][(i+1)&1] &= arr[a]; } } int ans = 0; for(int i=1;i<=n;i++){ ans += dp[i][(input.length())&1].count(); } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 512 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 1 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 512 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 1 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 90 ms | 384 KB | Output is correct |
23 | Correct | 90 ms | 384 KB | Output is correct |
24 | Correct | 87 ms | 384 KB | Output is correct |
25 | Correct | 86 ms | 384 KB | Output is correct |
26 | Correct | 82 ms | 484 KB | Output is correct |
27 | Correct | 147 ms | 384 KB | Output is correct |
28 | Correct | 149 ms | 384 KB | Output is correct |
29 | Correct | 150 ms | 384 KB | Output is correct |
30 | Correct | 150 ms | 504 KB | Output is correct |
31 | Correct | 149 ms | 512 KB | Output is correct |
32 | Correct | 196 ms | 384 KB | Output is correct |
33 | Correct | 195 ms | 512 KB | Output is correct |
34 | Correct | 199 ms | 504 KB | Output is correct |
35 | Correct | 196 ms | 488 KB | Output is correct |
36 | Correct | 194 ms | 504 KB | Output is correct |