Submission #130972

# Submission time Handle Problem Language Result Execution time Memory
130972 2019-07-16T10:33:42 Z IOrtroiii Nautilus (BOI19_nautilus) C++14
100 / 100
223 ms 1064 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 505;
using Val = bitset<N>;

Val org[N];
Val now[N];
Val nxt[N];

int main() {
   ios_base::sync_with_stdio(false);
   int n, m, k;
   cin >> n >> m >> k;
   vector<string> brd(n);
   for (int i = 0; i < n; ++i) {
      cin >> brd[i];
      for (int j = 0; j < m; ++j) {
         if (brd[i][j] == '.') {
            org[i].set(j);
         }
      }
      now[i] = org[i];
   }
   string mvs;
   cin >> mvs;
   for (char c : mvs) {
      for (int i = 0; i < n; ++i) {
         nxt[i] = {};
      }
      if (c == 'N' || c == '?') {
         for (int i = 0; i + 1 < n; ++i) {
            nxt[i] |= now[i + 1];
         }
      }
      if (c == 'E' || c == '?') {
         for (int i = 0; i < n; ++i) {
            nxt[i] |= (now[i] << 1);
         }
      }
      if (c == 'S' || c == '?') {
         for (int i = 1; i < n; ++i) {
            nxt[i] |= now[i - 1];
         }
      }
      if (c == 'W' || c == '?') {
         for (int i = 0; i < n; ++i) {
            nxt[i] |= (now[i] >> 1);
         }
      }
      for (int i = 0; i < n; ++i) {
         now[i] = nxt[i] & org[i];
      }
   }
   int ans = 0;
   for (int i = 0; i < n; ++i) {
      ans += now[i].count();
   }
   cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 372 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 372 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 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 392 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 376 KB Output is correct
18 Correct 3 ms 376 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 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 372 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 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 392 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 376 KB Output is correct
18 Correct 3 ms 376 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 136 ms 1016 KB Output is correct
23 Correct 138 ms 1000 KB Output is correct
24 Correct 137 ms 1016 KB Output is correct
25 Correct 135 ms 1008 KB Output is correct
26 Correct 134 ms 888 KB Output is correct
27 Correct 180 ms 1008 KB Output is correct
28 Correct 182 ms 932 KB Output is correct
29 Correct 182 ms 888 KB Output is correct
30 Correct 187 ms 888 KB Output is correct
31 Correct 183 ms 984 KB Output is correct
32 Correct 219 ms 1016 KB Output is correct
33 Correct 222 ms 1064 KB Output is correct
34 Correct 218 ms 1016 KB Output is correct
35 Correct 223 ms 1016 KB Output is correct
36 Correct 220 ms 988 KB Output is correct