Submission #514799

#TimeUsernameProblemLanguageResultExecution timeMemory
514799ymmNautilus (BOI19_nautilus)C++17
100 / 100
185 ms680 KiB
/// /// What would happen if we used assembly language for CP? /// Sorry, that was a strange thing to ask. /// #include <bits/stdc++.h> #define Loop(x,l,r) for(ll x = ll(l); x < ll(r); ++x) #define LoopR(x,l,r) for(ll x = ll(r)-1; x >= ll(l); --x) #define Kill(x) exit((cout << (x) << '\n', 0)) typedef long long ll; typedef std::pair<int,int> pii; typedef std::pair<ll,ll> pll; using namespace std; const int N = 510; bitset<N> cur[2][N]; bitset<N> isl[N]; int n, m, k; void up(char c){ Loop(i,0,n){ cur[1][i].reset(); if( c=='?' || c=='E') {cur[1][i] |= cur[0][i]<<1; cur[1][i][m]=0;} if( c=='?' || c=='W') cur[1][i] |= cur[0][i]>>1; if((c=='?' || c=='N') && i+1<n) cur[1][i] |= cur[0][i+1]; if((c=='?' || c=='S') && i >0) cur[1][i] |= cur[0][i-1]; cur[1][i] &= isl[i]; } Loop(i,0,n) cur[0][i] = cur[1][i]; } int main() { cin.tie(0) -> sync_with_stdio(false); cin >> n >> m >> k; Loop(i,0,n) Loop(j,0,m){ char c; cin >> c; isl[i][j] = cur[0][i][j] = c=='.'; } Loop(i,0,k){ char c; cin >> c; up(c); } int ans = 0; Loop(i,0,n) ans += cur[0][i].count(); cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...