답안 #542718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
542718 2022-03-27T16:04:11 Z OttoTheDino Nautilus (BOI19_nautilus) C++17
컴파일 오류
0 ms 0 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;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:46:25: error: expected ')' before ';' token
   46 |          nb[i] &= sea[i];
      |                         ^
      |                         )
nautilus.cpp:45:26: note: to match this '('
   45 |     for (int i=0;i<n;++i)(
      |                          ^
nautilus.cpp:48:5: error: expected primary-expression before ')' token
   48 |     )
      |     ^