Submission #314308

#TimeUsernameProblemLanguageResultExecution timeMemory
314308shrek12357Nautilus (BOI19_nautilus)C++14
29 / 100
4 ms384 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> #include <stack> #include <bitset> using namespace std; #define ll long long //cin.tie(0);ios_base::sync_with_stdio(0); int main() { int r, c, m; cin >> r >> c >> m; int grid[105][105]; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { char x; cin >> x; if (x == '.') { grid[i][j] = 1; } else { grid[i][j] = 0; } } } string s; cin >> s; int counter = 0; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { int curX = i, curY = j; bool bad = false; if (grid[i][j] == 0) { continue; } for (int k = 0; k < m; k++) { if (s[k] == 'W') { curY--; } if (s[k] == 'E') { curY++; } if (s[k] == 'N') { curX--; } if (s[k] == 'S') { curX++; } if (curX >= r || curX < 0 || curY >= c || curY < 0 || grid[curX][curY] == 0) { bad = true; break; } } if (!bad) { counter++; } } } cout << counter << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...