Submission #868628

# Submission time Handle Problem Language Result Execution time Memory
868628 2023-11-01T03:31:23 Z NeroZein Nautilus (BOI19_nautilus) C++17
0 / 100
0 ms 348 KB
#include "bits/stdc++.h"
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif

const int N = 501;

char c[N][N]; 
bitset<10> dp[N], ndp[N], ok[N]; 

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> c[i][j];
      ok[i][j] = (c[i][j] == '.'); 
    }
    //deb(ok[i]) cout << '\n';
  }
  cout << '\n';
  string s;
  cin >> s; 
  for (int i = 1; i <= n; ++i) {
    dp[i] = ok[i]; 
  }
  for (int p = 0; p < k; ++p) {
    for (int i = 1; i <= n; ++i) {
      if (s[p] == 'W') {
        deb(dp[i]) cout << '\n';
        ndp[i] |= dp[i] >> 1; 
      } else if (s[p] == 'E') {
        ndp[i] |= dp[i] << 1; 
      } else if (s[p] == 'N') {
        ndp[i - 1] |= dp[i]; 
      } else if (s[p] == 'S') {
        ndp[i + 1] |= dp[i]; 
      } else {
        ndp[i] |= (dp[i] >> 1) | (dp[i] << 1); 
        ndp[i - 1] |= dp[i];
        ndp[i + 1] |= dp[i];
      }
    }
    for (int i = 1; i <= n; ++i) {
      ndp[i] &= ok[i]; 
      dp[i] = ndp[i];
      ndp[i].reset();
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += dp[i].count();
  }
  cout << ans << '\n'; 
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -