제출 #496229

#제출 시각아이디문제언어결과실행 시간메모리
496229vinnipuh01Nautilus (BOI19_nautilus)C++17
0 / 100
3 ms332 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, int o = 0 ) { char i; for ( int j = o; j < s.size(); j ++ ) { i = s[ j ]; if ( i == 'N' ) { x --; if ( x <= 0 || c[ x ][ y ] == '#' ) return; } else if ( i == 'E' ) { y ++; if ( y > m || c[ x ][ y ] == '#' ) return; } else if ( i == 'S' ) { x ++; if ( x > n || c[ x ][ y ] == '#' ) return; } else if ( i == 'W' ) { y--; if ( y <= 0 || c[ x ][ y ] == '#' ) return; } else { if ( x < n ) ok( x + 1, y, o + 1 ); if ( x > 1 ) ok( x - 1, y, o + 1 ); if ( y < m ) ok( x, y + 1, o + 1 ); if ( y > 1 ) ok( x, y - 1, o + 1 ); } } mp[ x ][ y ] = 1; } int main () { cin >> n >> m >> k; 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 / 2; } /* 5 9 7 ...##.... ..#.##..# ..#....## .##...#.. ....#.... WSEEN */

컴파일 시 표준 에러 (stderr) 메시지

nautilus.cpp: In function 'void ok(int, int, int)':
nautilus.cpp:52:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |  for ( int j = o; j < s.size(); j ++ ) {
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...