#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500;
int r, c, m;
int cnt;
string str;
string mp[MAXN+5];
bool f(int i, int j) {
if (mp[i][j] == '#') return 0;
cout << mp[i][j];
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++;
cout << mp[i][j];
if (mp[i][j] == '#') return 0;
}
cout << "\n";
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";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
1272 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
1272 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
1272 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |