Submission #542719

# Submission time Handle Problem Language Result Execution time Memory
542719 2022-03-27T16:04:51 Z OttoTheDino Nautilus (BOI19_nautilus) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

int main () {
  int n, m, k; cin >> n >> m>>k;
  bitset<500> b[n], sea[n];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      char c; cin >> c;
      b[i][j] = sea[i][j] = (c=='.');
    }
  }
  for (int i=0;i<k;++i){
    char c; cin >> c;
    bitset<500> nb[n];
    if (c=='N') {
      for (int i=0;i<n-1;++i){
        nb[i] = b[i+1];
      }
    }
    else if (c=='S') {
      for (int i=1;i<n;++i){
        nb[i] = b[i-1];
      }
    }
    else if (c=='W') {
      for (int i=0;i<n;++i){
        nb[i] = b[i]<<1;
      }
    }
    else if (c=='E') {
      for (int i=0;i<n;++i){
        nb[i] = b[i]>>1;
      }
    }
    else {

      for (int i=0;i<n;++i){

        if (i>1) nb[i] |= b[i-1];
        if (i<n-1) nb[i] |= b[i+1];
        nb[i] |= ((b[i]<<1)|(b[i]>>1));
      }
    }
    for (int i=0;i<n;++i){
         nb[i] &= sea[i];

    }
    memcpy(b,nb,sizeof(nb));
  }
  int ans=0;
  for (int i = 0; i <n; ++i){
    ans += b[i].count();
  }
  cout << ans << endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -