Submission #542717

#TimeUsernameProblemLanguageResultExecution timeMemory
542717OttoTheDinoNautilus (BOI19_nautilus)C++17
0 / 100
1 ms212 KiB
#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 << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...