답안 #857179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
857179 2023-10-05T13:54:09 Z Trisanu_Das Nautilus (BOI19_nautilus) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int r, c, m;
string a[100], s;

int main(){
  cin >> r >> c >> m;
  for(int i = 0; i < r; i++) cin >> a[i];
  cin >> s;
  bitset<1000> dp[r], temp[r], aa[r];
  for(int i = 0; i < r; i++) for(int j = 0; j < c; j++) dp[i][j] = aa[i][j] = a[i][c - j - 1];
  for(auto dir : s){
    for(int i = 0; i < r; i++){
      if(dir == 'N') {
        if(i + 1 < r) dp[i] = dp[i + 1] & aa[i];
        else dp[i].reset();
      }
      if(dir == 'E') dp[i] = (dp[i] >> 1) & aa[i];
      if(dir == 'W') dp[i] = (dp[i] << 1) & aa[i];
      if(dir == '?'){
        temp[i] = (reach[i] >> 1) | (reach[i] << 1);
        if(i) temp[i] |= reach[i -1];
        if(i + 1 < r) temp[i] |= reach[i + 1];
        temp[i] &= aa[i];
      }
    }
    for(int i = r - 1; i > -1; i--){
      if(w == 'S'){
        if(i) reach[i] = reach[i - 1] & aa[i];
        else reach[i].reset();
      }
    }
    for(int i = 0; i < r; i++) if(w == '?') reach[i] = temp[i];
  }
  int ans = 0;
  for(int i = 0; i < r; i++) ans += reach.count();
  cout << ans << '\n';
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:22:20: error: 'reach' was not declared in this scope
   22 |         temp[i] = (reach[i] >> 1) | (reach[i] << 1);
      |                    ^~~~~
nautilus.cpp:29:10: error: 'w' was not declared in this scope
   29 |       if(w == 'S'){
      |          ^
nautilus.cpp:30:15: error: 'reach' was not declared in this scope
   30 |         if(i) reach[i] = reach[i - 1] & aa[i];
      |               ^~~~~
nautilus.cpp:31:14: error: 'reach' was not declared in this scope
   31 |         else reach[i].reset();
      |              ^~~~~
nautilus.cpp:34:35: error: 'w' was not declared in this scope
   34 |     for(int i = 0; i < r; i++) if(w == '?') reach[i] = temp[i];
      |                                   ^
nautilus.cpp:34:45: error: 'reach' was not declared in this scope
   34 |     for(int i = 0; i < r; i++) if(w == '?') reach[i] = temp[i];
      |                                             ^~~~~
nautilus.cpp:37:37: error: 'reach' was not declared in this scope
   37 |   for(int i = 0; i < r; i++) ans += reach.count();
      |                                     ^~~~~