Submission #134868

#TimeUsernameProblemLanguageResultExecution timeMemory
134868Bodo171Nautilus (BOI19_nautilus)C++14
100 / 100
317 ms892 KiB
#include <iostream> #include <fstream> #include <bitset> using namespace std; const int nmax=1005; string s,mov; bitset<nmax> can[nmax],niu[nmax],ok[nmax]; int n,m,k,i,j,mv; int main() { ios_base::sync_with_stdio(false); cin>>n>>m>>k; for(i=1;i<=n;i++) { cin>>s; for(j=0;j<m;j++) { if(s[j]=='.') { ok[i][j]=1,can[i][j]=1; } } } cin>>mov; for(int mv=0;mv<mov.size();mv++) { if(mov[mv]=='N') { for(i=1;i<=n+1;i++) can[i-1]=((can[i]&ok[i-1])); } if(mov[mv]=='S') { for(i=n;i>=0;i--) can[i+1]=(can[i]&ok[i+1]); } if(mov[mv]=='E') { for(i=1;i<=n;i++) can[i]=((can[i]<<1)&ok[i]); } if(mov[mv]=='W') { for(i=1;i<=n;i++) can[i]=((can[i]>>1)&ok[i]); } if(mov[mv]=='?') { for(i=1;i<=n;i++) niu[i]=((can[i-1]|can[i+1]|(can[i]>>1)|(can[i]<<1))&ok[i]); for(i=1;i<=n;i++) can[i]=niu[i]; } } int ans=0; for(i=1;i<=n;i++) ans+=can[i].count(); cout<<ans; return 0; }

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:25:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int mv=0;mv<mov.size();mv++)
                  ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...