Submission #260321

#TimeUsernameProblemLanguageResultExecution timeMemory
260321arnold518Nautilus (BOI19_nautilus)C++14
0 / 100
1 ms1536 KiB
#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 (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &R, &C, &M);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:20:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=R; i++) scanf("%s", S[i]+1);
                          ~~~~~^~~~~~~~~~~~~~
nautilus.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", A+1);
  ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...