Submission #486283

#TimeUsernameProblemLanguageResultExecution timeMemory
486283ez_ioiNautilus (BOI19_nautilus)C++17
100 / 100
184 ms1220 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mxN = 5e2 + 5, mod = 1e9 + 7, LOG = 20; int r, c, m; bool a[mxN][mxN]; bitset <mxN * mxN> A, B; int main() { ios :: sync_with_stdio(false), cin.tie(nullptr); cin >> r >> c >> m; for (int i = 1; i <= r; ++i) { for (int j = 1; j <= c; ++j) { char b; cin >> b; a[i][j] = (b == '.'); A[i * mxN + j] = B[i * mxN + j] = a[i][j]; } } string s; cin >> s; for (int i = 0; i < m; ++i) { if (s[i] == 'S') A <<= mxN; else if (s[i] == 'N') A >>= mxN; else if (s[i] == 'W') A >>= 1; else if (s[i] == 'E') A <<= 1; else if (s[i] == '?') A = (A << mxN) | (A >> mxN) | (A >> 1) | (A << 1); A &= B; // only water parts should be remained } cout << A.count(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...