답안 #889761

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
889761 2023-12-20T06:57:21 Z vjudge1 Nautilus (BOI19_nautilus) C++17
29 / 100
3 ms 348 KB
#include <bits/stdc++.h>
#define ll long long
#define fort(x , y) for(int y = 1 ; y <= x ; y++)
#define pb push_back
#define pf push_front
#define ppb pop_back
#define int long long
#define F first
#define S second
using namespace std;
const int N = 2e5 + 5;
const int NN = 1e9 + 7;
int r,c,m,k;
char s[501][501];
string p;
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin >> r >> c >> m;
	for(int i = 1 ; i <= r ; i++){
		for(int j = 1 ; j <= c ; j++){
			cin >> s[i][j];
		}
	}
	cin >> p;
	p = '#' + p;
	int ans = 0;
	for(int i = 1 ; i <= r ; i++){
		for(int j = 1 ; j <= c ; j++){
			bool oknt = 0;
			if(s[i][j] == '#'){
				continue;
			}
			int now1 = i , now2 = j;
			for(int u = 1 ; u <= m ; u++){
				if(p[u] == '?'){
					continue;
				}
				if(p[u] == 'N'){
					if(s[now1 - 1][now2] != '.'){
						oknt = 1; 
						break;
					}
					now1--;
				}
				if(p[u] == 'E'){
					if(s[now1][now2 + 1] != '.'){
						oknt = 1;
						break;
					}
					now2++;
				}
				if(p[u] == 'S'){
					if(s[now1 + 1][now2] != '.'){
						oknt = 1;
						break;
					}
					now1++;
				}
				if(p[u] == 'W'){
					if(s[now1][now2 - 1] != '.'){
						oknt = 1;
						break;
					}
					now2--;
				}
			}
			if(oknt == 0){
				ans ++;
			}
		}
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 3 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 3 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -