Submission #542714

# Submission time Handle Problem Language Result Execution time Memory
542714 2022-03-27T15:57:29 Z OttoTheDino Nautilus (BOI19_nautilus) C++17
Compilation error
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));
        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 << ”\n”;
  return 0;
}

Compilation message

nautilus.cpp:52:18: error: extended character ” is not valid in an identifier
   52 |   cout << ans << ”\n”;
      |                  ^
nautilus.cpp:52:21: error: stray '\' in program
   52 |   cout << ans << ”\n”;
      |                   ^
nautilus.cpp:52:22: error: extended character ” is not valid in an identifier
   52 |   cout << ans << ”\n”;
      |                    ^
nautilus.cpp: In function 'int main()':
nautilus.cpp:9:13: error: found ':' in nested-name-specifier, expected '::'
    9 |       char c: cin >> c;
      |             ^
      |             ::
nautilus.cpp:9:12: error: 'c' has not been declared
    9 |       char c: cin >> c;
      |            ^
nautilus.cpp:9:19: error: qualified-id in declaration before '>>' token
    9 |       char c: cin >> c;
      |                   ^~
nautilus.cpp:10:30: error: 'c' was not declared in this scope
   10 |       b[i][j] = sea[i][j] = (c=='.');
      |                              ^
nautilus.cpp:52:18: error: '\U0000201d' was not declared in this scope
   52 |   cout << ans << ”\n”;
      |                  ^