Submission #471407

#TimeUsernameProblemLanguageResultExecution timeMemory
471407SirCovidThe19thNautilus (BOI19_nautilus)C++17
100 / 100
230 ms936 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, m, op; cin >> n >> m >> op; n += 2, m += 2; bitset<255000> dp, ok; for (int i = 1; i < n - 1; i++) for (int j = 1; j < m - 1; j++){ char c; cin >> c; if (c == '.') dp[i * m + j] = ok[i * m + j] = 1; } for (int i = 0; i < op; i++){ char c; cin >> c; if (c == 'N') dp >>= m; if (c == 'S') dp <<= m; if (c == 'W') dp >>= 1; if (c == 'E') dp <<= 1; if (c == '?') dp = (dp << m) | (dp >> m) | (dp << 1) | (dp >> 1); dp &= ok; } cout<<dp.count()<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...