Submission #647571

#TimeUsernameProblemLanguageResultExecution timeMemory
647571berrNautilus (BOI19_nautilus)C++17
100 / 100
191 ms724 KiB
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, m, k; cin>>n>>m>>k; bitset<505> grid[n], sea[n]; for(int i=0; i<n; i++) { for(int l=0; l<m; l++) { char x; cin>>x; if(x=='.') sea[i][l]=grid[i][l]=1; else sea[i][l]=grid[i][l]=0; } } string s; cin>>s; for(int i=0; i<s.size(); i++) { bitset<505> tmp[n]; if(s[i]=='W'||s[i]=='?') { for(int l=0; l<n; l++) { tmp[l]|=(sea[l]&(grid[l]>>1)); } } if(s[i]=='E'||s[i]=='?') { for(int l=0; l<n; l++) { tmp[l]|=sea[l]&(grid[l]<<1); } } if(s[i]=='N'||s[i]=='?') { for(int l=0; l<n-1; l++) { tmp[l]|=(sea[l]&grid[l+1]); } } if(s[i]=='S'||s[i]=='?') { for(int l=1; l<n; l++) { tmp[l]|=sea[l]&grid[l-1]; } } for(int l=0; l<n; l++) { grid[l]=tmp[l]; } } int ans=0; for(int i=0; i<n; i++) { for(int l=0; l<m; l++) { if(grid[i][l]) ans++; } } cout<<ans; }

Compilation message (stderr)

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