#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
444 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
444 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Incorrect |
3 ms |
344 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
444 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Incorrect |
3 ms |
344 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |