Submission #129988

#TimeUsernameProblemLanguageResultExecution timeMemory
129988TadijaSebezNautilus (BOI19_nautilus)C++11
100 / 100
364 ms1324 KiB
#include <bits/stdc++.h> using namespace std; const int N=505; const int M=5005; char s[N][N],op[M]; int main() { int n,m,q; scanf("%i %i %i",&n,&m,&q); for(int i=0;i<n;i++) scanf("%s",s[i]); scanf("%s",op+1); bitset<N*N> dp,ok; for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(s[i][j]=='.') ok[i*N+j]=1; dp=ok; for(int i=1;i<=q;i++) { if(op[i]=='W') dp=dp>>1; if(op[i]=='N') dp=dp>>N; if(op[i]=='E') dp=dp<<1; if(op[i]=='S') dp=dp<<N; if(op[i]=='?') dp=(dp>>1)|(dp<<1)|(dp>>N)|(dp<<N); dp=dp&ok; } printf("%i\n",dp.count()); return 0; }

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:24:26: warning: format '%i' expects argument of type 'int', but argument 2 has type 'std::size_t {aka long unsigned int}' [-Wformat=]
  printf("%i\n",dp.count());
                ~~~~~~~~~~^
nautilus.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i %i",&n,&m,&q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++) scanf("%s",s[i]);
                       ~~~~~^~~~~~~~~~~
nautilus.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",op+1);
  ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...