Submission #719883

#TimeUsernameProblemLanguageResultExecution timeMemory
719883jamezzzNautilus (BOI19_nautilus)C++17
100 / 100
134 ms716 KiB
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define INF 1023456789 #define maxn 505 int r,c,m; bitset<maxn> grid[maxn],pos[maxn],pos2[maxn]; int main(){ sf("%d%d%d",&r,&c,&m); for(int i=1;i<=r;++i){ for(int j=1;j<=c;++j){ char ch;sf(" %c",&ch); if(ch=='.'){ grid[i].set(j,1); pos[i].set(j,1); } } } for(int i=0;i<m;++i){ char ch;sf(" %c",&ch); for(int i=1;i<=r;++i){ pos2[i].reset(); if(ch=='W'||ch=='?'){ pos2[i]|=(pos[i]>>1)&grid[i]; } if(ch=='E'||ch=='?'){ pos2[i]|=(pos[i]<<1)&grid[i]; } if(ch=='N'||ch=='?'){ pos2[i]|=pos[i+1]&grid[i]; } if(ch=='S'||ch=='?'){ pos2[i]|=pos[i-1]&grid[i]; } } for(int i=1;i<=r;++i)pos[i]=pos2[i]; } int ans=0; for(int i=1;i<=r;++i)ans+=pos[i].count(); printf("%d\n",ans); } /* 5 9 7 ...##.... ..#.##..# ..#....## .##...#.. ....#.... WS?EE?? */

Compilation message (stderr)

nautilus.cpp: In function 'int main()':
nautilus.cpp:13:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  sf("%d%d%d",&r,&c,&m);
      |    ^
nautilus.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |    char ch;sf(" %c",&ch);
      |              ^
nautilus.cpp:24:13: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   char ch;sf(" %c",&ch);
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...