Submission #484404

#TimeUsernameProblemLanguageResultExecution timeMemory
484404nickmet2004Addk (eJOI21_addk)C++11
0 / 100
2 ms1620 KiB
#include<bits/stdc++.h> using namespace std; const int N = 1505; int n , m , t; bitset<1500> row[N]; bitset<1500> dp[N] , d[N]; void J(char c){ if(c == 'N') for(int i= 1; i <= n; ++i) dp[i] = d[i + 1]; if(c == 'S') for(int i = 1; i <= n; ++i) dp[i] = d[i - 1]; if(c == 'E') for(int i= 1; i <= n; ++i) dp[i] = (d[i] << 1); if(c == 'W') for(int i= 1; i <= n; ++i) dp[i] = (d[i] >> 1); if(c == '?'){ for(int i= 1; i <= n; ++i){ dp[i] = d[i + 1]; dp[i] |= d[i - 1]; dp[i] |= (d[i]>>1); dp[i] |= (d[i] << 1); } } for(int i= 1; i <= n; ++i) dp[i] = dp[i] & row[i]; } int main (){ cin >> n >> m >> t; for(int i = 1; i <= n; ++i){ char ch; for(int j = 0; j < m; ++j){ cin >> ch; if(ch == '.') dp[i][j] = 1 , row[i][j] = 1; else dp[i][j] = 0 , row[i][j] = 0; } } //for(int i =1; i<= n; ++i) cout << row[i] <<endl; string s; cin >> s; for(int i = 0; i< t; ++i){ for(int j =1; j <= n; ++j) d[j]=dp[j]; J(s[i]); } int ans = 0; for(int i = 1; i <= n; ++i) ans += dp[i].count(); cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...