답안 #655869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
655869 2022-11-05T20:20:11 Z 600Mihnea Nautilus (BOI19_nautilus) C++17
0 / 100
0 ms 212 KB
bool home = 1;
bool verbose;

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 500 + 7;
int n;
int m;
int sdim;
bitset<N> valid_place[N];
bitset<N> ok[N];
bitset<N> nok[N];
string s;

int main() {
  if (home) {
    verbose = 1;
    freopen ("___input___.txt", "r", stdin);
  } else {
    verbose = 0;
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  }

  cin >> n >> m >> sdim;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (int j = 1; j <= m; j++) {
      char ch = s[j - 1];
      valid_place[i][j] = (ch == '.');
    }
  }
  cin >> s;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      ok[i][j] = valid_place[i][j];
    }
  }
  for (int itp = 0; itp < sdim; itp++) {
    char ch = s[itp];
    for (int i = 1; i <= n; i++) {
      nok[i] = 0;
    }
    if (ch == 'N' || ch == '?') {
      for (int i = 1; i <= n; i++) {
        nok[i] |= ok[i + 1];
      }
    }
    if (ch == 'S' || ch == '?') {
      for (int i = 1; i <= n; i++) {
        nok[i] |= ok[i - 1];
      }
    }
    if (ch == 'E' || ch == '?') {
      for (int i = 1; i <= n; i++) {
        nok[i] |= (ok[i] << 1);
      }
    }
    if (ch == 'W' || ch == '?') {
      for (int i = 1; i <= n; i++) {
        nok[i] |= (ok[i] >> 1);
      }
    }
    for (int i = 1; i <= n; i++) {
      ok[i] = nok[i] & valid_place[i];
    }
  }
  int sol = 0;
  for (int i = 1; i <= n; i++) {
    sol += ok[i].count();
  }
  cout << sol << "\n";
  return 0;
}


/**

**/

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:22:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     freopen ("___input___.txt", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -