Submission #923802

#TimeUsernameProblemLanguageResultExecution timeMemory
923802MathiasNautilus (BOI19_nautilus)C++14
100 / 100
146 ms856 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 507; bitset<MAXN> st[MAXN],bs[MAXN],xd[MAXN],tmp,tmp1,tmp2,tmp3; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int r,c,m,ans=0; char zn; string s; cin>>r>>c>>m; for(int i=1;i<=r;i++){ for(int j=0;j<c;j++){ cin>>zn; if(zn=='.') bs[i][j]=st[i][j]=1; } } cin>>s; s="#"+s; for(int i=1;i<s.size();i++){ for(int j=1;j<=r;j++){ if(s[i]=='?'){ tmp=(bs[j+1]|bs[j-1]); tmp1=(bs[j]<<1); tmp2=(bs[j]>>1); tmp3=tmp1|tmp2; xd[j]=tmp3|tmp; } else if(s[i]=='N') xd[j]=bs[j+1]; else if(s[i]=='S') xd[j]=(bs[j-1]); else if(s[i]=='E') xd[j]=(bs[j]<<1); else xd[j]=(bs[j]>>1); } for(int j=1;j<=r;j++){ bs[j]=(xd[j]&st[j]); } } for(int i=1;i<=r;i++) ans+=bs[i].count(); cout<<ans<<'\n'; return 0; }

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:16:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int i=1;i<s.size();i++){
      |              ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...