Submission #1036004

#TimeUsernameProblemLanguageResultExecution timeMemory
1036004ByeWorldNautilus (BOI19_nautilus)C++14
100 / 100
144 ms1024 KiB
#include <bits/stdc++.h> // #pragma GCC optimize("O3", "unroll-loops") #define ll long long #define int long long #define pb push_back #define fi first #define se second #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) #define ld long double using namespace std; typedef pair<int,int> pii; typedef pair<pii, int> ipii; const int MAXN = 26e4; const int MAXK = 110; const int INF = 1e9+10; const int LOG = 19; const int MOD = 998244353; const int SQRT = 450; void chmn(int &a, int b){ a = min(a, b); } int n, m, k; bitset <MAXN> ma, ans, te; signed main(){ cin >> n >> m >> k; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ char x; cin >> x; if(x=='.') ma[i*(m+1)+j] = 1; } } ans = ma; string s; cin >> s; for(int i=0; i<k; i++){ if(s[i]=='?'){ ans = ((ans<<(m+1)) | (ans>>(m+1)) | (ans<<1) | (ans>>1)) & ma; } else if(s[i]=='E'){ ans = (ans<<1) & ma; } else if(s[i]=='W'){ ans = (ans>>1) & ma; } else if(s[i]=='S'){ ans = (ans<<(m+1)) & ma; } else if(s[i]=='N'){ ans = (ans>>(m+1)) & ma; } } cout << ans.count() << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...