제출 #414684

#제출 시각아이디문제언어결과실행 시간메모리
414684tengiz05Nautilus (BOI19_nautilus)C++17
29 / 100
4 ms284 KiB
#include <bits/stdc++.h> using i64 = long long; constexpr int N = 105; char g[N][N]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, m, k; std::cin >> n >> m >> k; memset(g, '#', sizeof g); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { std::cin >> g[i][j]; } } std::string s; std::cin >> s; int ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (g[i][j] == '#') continue; int x = i, y = j; bool ok = true; for (int d = 0; d < k; d++) { if (s[d] == 'N') x--; if (s[d] == 'S') x++; if (s[d] == 'W') y--; if (s[d] == 'E') y++; if (g[x][y] == '#') { ok = false; break; } } ans += ok; } } std::cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...