답안 #496226

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496226 2021-12-21T03:26:18 Z vinnipuh01 Nautilus (BOI19_nautilus) C++17
29 / 100
5 ms 332 KB
#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 == '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 {
			y--;
			if ( y <= 0 || c[ x ][ y ] == '#' )
				return;
		}
	}
	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;
}


/*
5 9 7
...##....
..#.##..#
..#....##
.##...#..
....#....
WSEEN


*/
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Incorrect 3 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Incorrect 3 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -