제출 #496213

#제출 시각아이디문제언어결과실행 시간메모리
496213vinnipuh01Nautilus (BOI19_nautilus)C++17
0 / 100
1 ms204 KiB
#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 mp[ 501 ][ 501 ]; void ok( int x, int y ) { for ( auto i : s ) { if ( i == 'W' ) { x ++; if ( x > n || c[ x ][ y ] == '#' ) return; } else if ( i == 'E' ) { y ++; if ( y > m || c[ x ][ y ] == '#' ) return; } else if ( i == 'S' ) { x --; if ( x <= 0 || c[ x ][ y ] == '#' ) return; } else { y--; if ( y <= 0 || c[ x ][ y ] == '#' ) return; } } mp[ x ][ y ] = 1; } 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 ] != '#' ) ok( i, j ); } } for ( int i = 1; i <= n; i ++ ) { for ( int j = 1; j <= m; j ++ ) ans += mp[ i ][ j ]; } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...