Submission #593257

# Submission time Handle Problem Language Result Execution time Memory
593257 2022-07-10T16:53:21 Z cadmiumsky Nautilus (BOI19_nautilus) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<bitset<11>> mat(n + 2), templ, temp;
  for(int i = 1; i <= n; i++) {
    for(int j = m; j > 0; j--) {
      char ch;
      cin >> ch;
      mat[i][j] = (ch == '.'? 1 : 0);
      //cout << ch << " \n"[j == 1];
    }
  }
  templ = mat;
  
    
  for(int tc = 0; tc < q; tc++) {
    char ch;
    cin >> ch;
    if(ch == 'W') {
      for(int i = 1; i <= n; i++)
        mat[i] = (templ[i] & (mat[i] << 1));
    }
    if(ch == 'E') {
      for(int i = 1; i <= n; i++)
        mat[i] = (templ[i] & (mat[i] >> 1));
    }
    if(ch == 'N') {
      for(int i = 1; i <= n; i++) {
        mat[i] = mat[i + 1] & templ[i];
      }
    }
    if(ch == 'S') {
      for(int i = n; i > 0; i--) {
        mat[i] = mat[i - 1] & templ[i];
      }
    }
    if(ch == '?') {
      temp = mat;
      for(int i = 1; i <= n; i++)
        mat[i] = ((mat[i] >> 1) | (mat[i] << 1) | temp[i - 1] | temp[i + 1]) & templ[i];
    }
    //for(int i = 1; i <= n; i++) {
      //cerr << mat[i] << '\n';
    //}
    //cerr << '\n';
  }
  int total = 0;
  for(int i = 1; i <= n; i++) {
    total += mat[i].count();
  }
  cout << total << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -