# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
125006 | 2019-07-04T10:46:11 Z | gs14004 | Nautilus (BOI19_nautilus) | C++17 | 213 ms | 1016 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 505; int n, m, k; bitset<MAXN> dp[MAXN], nxt[MAXN], grid[MAXN]; char str[MAXN][MAXN]; int main(){ scanf("%d %d %d",&n,&m,&k); for(int i=0; i<n; i++){ scanf("%s", str[i]); for(int j=0; j<m; j++){ if(str[i][j] == '.') grid[i].set(j); } dp[i] = grid[i]; } string q; cin >> q; for(auto &i : q){ for(int j=0; j<n; j++) nxt[j] = 0; if(i == 'W' || i == '?'){ for(int j=0; j<n; j++) nxt[j] |= (dp[j] >> 1); } if(i == 'E' || i == '?'){ for(int j=0; j<n; j++) nxt[j] |= (dp[j] << 1); } if(i == 'N' || i == '?'){ for(int j=1; j<n; j++) nxt[j-1] |= dp[j]; } if(i == 'S' || i == '?'){ for(int j=1; j<n; j++) nxt[j] |= dp[j-1]; } for(int j=0; j<n; j++) dp[j] = nxt[j] & grid[j]; } int ret = 0; for(int j=0; j<n; j++) ret += dp[j].count(); cout << ret << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 632 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 632 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 380 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 380 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 380 KB | Output is correct |
18 | Correct | 3 ms | 504 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 632 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 248 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 380 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 380 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 380 KB | Output is correct |
18 | Correct | 3 ms | 504 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 3 ms | 376 KB | Output is correct |
22 | Correct | 135 ms | 1004 KB | Output is correct |
23 | Correct | 137 ms | 1016 KB | Output is correct |
24 | Correct | 133 ms | 888 KB | Output is correct |
25 | Correct | 134 ms | 888 KB | Output is correct |
26 | Correct | 132 ms | 984 KB | Output is correct |
27 | Correct | 177 ms | 972 KB | Output is correct |
28 | Correct | 179 ms | 972 KB | Output is correct |
29 | Correct | 178 ms | 972 KB | Output is correct |
30 | Correct | 179 ms | 888 KB | Output is correct |
31 | Correct | 176 ms | 888 KB | Output is correct |
32 | Correct | 212 ms | 1008 KB | Output is correct |
33 | Correct | 213 ms | 1016 KB | Output is correct |
34 | Correct | 213 ms | 888 KB | Output is correct |
35 | Correct | 212 ms | 888 KB | Output is correct |
36 | Correct | 212 ms | 888 KB | Output is correct |