| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1339988 | StefanSebez | Nautilus (BOI19_nautilus) | C++20 | 193 ms | 888 KiB |
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
const int N=505;
int R,C,n;
string S;
int pre,now=1;
bitset<N*N>dp[2],nula;
int main(){
scanf("%i%i%i",&R,&C,&n);
for(int i=0;i<R;i++){
string s;cin>>s;
for(int j=0;j<C;j++)if(s[j]=='.')nula[i*(C+1)+j]=1;;
}
cin>>S;
dp[now]=nula;
for(auto c:S){
swap(pre,now);
if(c=='E')dp[now]=(dp[pre]<<1)&nula;
if(c=='W')dp[now]=(dp[pre]>>1)&nula;
if(c=='S')dp[now]=(dp[pre]<<(C+1))&nula;
if(c=='N')dp[now]=(dp[pre]>>(C+1))&nula;
if(c=='?'){
dp[now]=((dp[pre]<<1)&nula)|((dp[pre]>>1)&nula)|((dp[pre]<<(C+1))&nula)|((dp[pre]>>(C+1))&nula);
}
}
int res=dp[now].count();
printf("%i\n",res);
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
