# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
260321 | 2020-08-10T05:20:44 Z | arnold518 | Nautilus (BOI19_nautilus) | C++14 | 1 ms | 1536 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 500; const int MAXM = 5000; int R, C, M; char S[MAXN+10][MAXN+10]; char A[MAXM+10]; bitset<501> B[MAXN+10]; bitset<501> D[MAXN+10][MAXM+10]; int main() { scanf("%d%d%d", &R, &C, &M); for(int i=1; i<=R; i++) scanf("%s", S[i]+1); scanf("%s", A+1); for(int i=1; i<=R; i++) for(int j=1; j<=C; j++) if(S[i][j]=='.') B[i][j-1]=1; for(int i=1; i<=R; i++) D[i][0]=B[i]; for(int p=1; p<=M; p++) { if(A[p]=='N' || A[p]=='?') { for(int i=1; i<R; i++) { D[i][p]|=D[i+1][p-1]; } } if(A[p]=='S' || A[p]=='?') { for(int i=2; i<=R; i++) { D[i][p]|=D[i-1][p-1]; } } if(A[p]=='E' || A[p]=='?') { for(int i=1; i<=R; i++) { D[i][p]|=D[i][p-1]<<1; } } if(A[p]=='W' || A[p]=='?') { for(int i=1; i<=R; i++) { D[i][p]|=D[i][p-1]>>1; } } for(int i=1; i<=R; i++) D[i][p]&=B[i]; } int ans=0; for(int i=1; i<=R; i++) for(int j=0; j<=C/64; j++) ans+=D[i][M].count(); printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1536 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1536 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1536 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |