#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
using namespace std;
const long long oo = 1000000000000000000;
long long int sum, ans = 0, mx = 0, mn = 1000000000, num, pos;
/*
ViHHiPuh
(( `'-""``""-'` ))
)-__-_.._-__-(
/ --- (o _ o) --- \
\ .-* ( .0. ) *-. /
_'-. ,_ '=' _, .-'_
/ `;#'#'# - #'#'#;` \
\_)) -----'#'----- ((_/
# --------- #
'# ------- ------ #'
/..-'# ------- #'-.\
_\...-\'# -- #'/-.../_
((____)- '#' -(____))
cout << fixed << setprecision(6) << x;
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
freopen ( "sum.in", "r", stdin )
*/
string s;
int n, m, k;
char c[ 501 ][ 501 ];
bool ok( int x, int y ) {
for ( auto i : s ) {
if ( i == 'W' ) {
x ++;
if ( c[ x ][ y ] == '#' )
return false;
}
else if ( i == 'E' ) {
y ++;
if ( c[ x ][ y ] == '#' )
return false;
}
else if ( i == 'S' ) {
x --;
if ( c[ x ][ y ] == '#' )
return false;
}
else {
y--;
if ( c[ x ][ y ] == '#' )
return false;
}
}
return true;
}
int main () {
int n, m, k;
cin >> n >> m >> k;
char c[ n + 1 ][ m + 1 ];
for ( int i = 1; i <= n; i ++ ) {
for ( int j = 1; j <= m; j ++ ) {
cin >> c[ i ][ j ];
}
}
cin >> s;
for ( int i = 1; i <= n; i ++ ) {
for ( int j = 1; j <= m; j ++ ) {
if ( c[ i ][ j ] != '#' )
ans += ok( i, j );
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |