Submission #927505

#TimeUsernameProblemLanguageResultExecution timeMemory
927505Sir_Ahmed_ImranNautilus (BOI19_nautilus)C++17
66 / 100
10 ms2652 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define append push_back #define add insert #define nl "\n" #define ff first #define ss second #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL) #define N 102 char a[N][N]; bool dp[N][N][N]; void solve(){ char r; int n,m,o,s; cin>>n>>m>>o; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; dp[i][j][0]=(a[i][j]=='.'); } } s=0; for(int k=1;k<=o;k++){ cin>>r; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='#') continue; if(r=='?'){ if(dp[i+1][j][k-1]) dp[i][j][k]=1; if(dp[i][j-1][k-1]) dp[i][j][k]=1; if(dp[i-1][j][k-1]) dp[i][j][k]=1; if(dp[i][j+1][k-1]) dp[i][j][k]=1; } if(r=='N' && dp[i+1][j][k-1]) dp[i][j][k]=1; if(r=='E' && dp[i][j-1][k-1]) dp[i][j][k]=1; if(r=='S' && dp[i-1][j][k-1]) dp[i][j][k]=1; if(r=='W' && dp[i][j+1][k-1]) dp[i][j][k]=1; if(dp[i][j][o]) s++; } } } cout<<s; } int main(){ L0TA; solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...