Submission #860177

#TimeUsernameProblemLanguageResultExecution timeMemory
860177maks007Nautilus (BOI19_nautilus)C++14
29 / 100
3 ms444 KiB
#include "bits/stdc++.h" using namespace std; signed main () { int n, m, c; cin >> n >> m >> c; string a[n]; for(int i = 0; i < n; i ++) { cin >> a[i]; } string str; function <int(int,int)> check=[&](int i, int j) { for(int ii = 0; ii < c; ii ++) { if(str[ii] == 'W') j --; else if(str[ii] == 'E') j ++; else if(str[ii] == 'S') i ++; else i --; if(j < 0 || i < 0 || i >= n || j >= m ||( a[i][j] == '#')) return 0; } return 1; }; cin >> str; int ans = 0; for(int i = 0; i < n; i ++) { for(int j = 0; j < m; j ++) { if(a[i][j] == '.') ans += check(i, j); } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...