Submission #1151682

#TimeUsernameProblemLanguageResultExecution timeMemory
1151682Robert_juniorNautilus (BOI19_nautilus)C++20
100 / 100
285 ms812 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define ins insert #define pb push_back #define F first #define S second const int N = 2e5+100, M = 5e5 + 7; const int mod = 1e9 + 7; char b[5001]; int n, m, k; int get(int i, int j){ return (i - 1) * 2 * m + j; } void solve(){ cin>>n>>m>>k; bitset<510000>base, res, base1, base2; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ char c; cin>>c; if(c == '.') base[get(i, j)] = 1; } } base1 = base; for(int i = 1; i <= k; i++){ cin>>b[i]; if(b[i] == 'W'){ res = (base>>1); } if(b[i] == 'E'){ res = (base<<1); } if(b[i] == 'S'){ res = (base<<(m * 2)); } if(b[i] == 'N'){ res = (base>>(m * 2)); } if(b[i] == '?'){ res = base2; res |= (base>>1); res |= (base<<1); res |= (base>>(m * 2)); res |= (base<<(m * 2)); } res &= base1; base = res; } int ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ ans += base[get(i, j)]; } } cout<<ans<<'\n'; } main(){ ios_base :: sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin>>t; for(int i = 1; i <= t; i++){ //cout<<"Case "<<i<<": "; solve(); } }

Compilation message (stderr)

nautilus.cpp:59:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   59 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...