Submission #723462

#TimeUsernameProblemLanguageResultExecution timeMemory
723462lovrotNautilus (BOI19_nautilus)C++17
66 / 100
101 ms608 KiB
#include <cstdio> #include <cstring> #include <bitset> using namespace std; const int N = 500; bitset<N> M[2][N + 2], S[N]; int main() { int n, m, q; scanf("%d%d%d", &n, &m, &q); for(int i = 1; i <= n; i++) for(int j = 0; j < m; j++) { char c; scanf(" %c", &c); S[i].set(j, c == '.'); M[0][i].set(j, c == '.'); } bool f = 0; for(int t = 0; t < q; t++) { char c; scanf(" %c", &c); f ^= 1; for(int i = 1; i <= n; i++) { if(c == 'W') M[f][i] = S[i] & (M[!f][i] >> 1); else if(c == 'E') M[f][i] = S[i] & (M[!f][i] << 1); else if(c == 'N') M[f][i] = S[i] & M[!f][i + 1]; else if(c == 'S') M[f][i] = S[i] & M[!f][i - 1]; else M[f][i] = S[i] & ((M[!f][i] << 1) | (M[!f][i] >> 1) | M[!f][i - 1] | M[!f][i + 1]); } } int sol = 0; for(int i = 1; i <= n; i++) sol += M[f][i].count(); printf("%d\n", sol); return 0; }

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d%d%d", &n, &m, &q);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |    scanf(" %c", &c);
      |    ~~~~~^~~~~~~~~~~
nautilus.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   scanf(" %c", &c);
      |   ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...