제출 #210627

#제출 시각아이디문제언어결과실행 시간메모리
210627casperwangNautilus (BOI19_nautilus)C++14
29 / 100
8 ms376 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 500; int r, c, m; int cnt; string str; string mp[MAXN+5]; int arr[MAXN+5][MAXN+5]; bool f(int i, int j) { if (mp[i][j] == '#') return 0; for (int k = 0; k < m; k++) { if (str[k] == 'N') i--; if (str[k] == 'S') i++; if (str[k] == 'W') j--; if (str[k] == 'E') j++; if (mp[i][j] == '#') return 0; } return 1; } signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> r >> c >> m; for (int i = 1; i <= r; i++) { cin >> mp[i]; mp[i] = "#" + mp[i] + "#"; } cin >> str; for (int i = 0; i <= c+1; i++) { mp[0] = mp[0] + "#"; mp[r+1] = mp[r+1] + "#"; } for (int i = 1; i <= r; i++) for (int j = 1; j <= c; j++) cnt += f(i, j); cout << cnt << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...