답안 #281983

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
281983 2020-08-23T18:25:12 Z bigg Nautilus (BOI19_nautilus) C++14
100 / 100
55 ms 896 KB
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const int MAXN = 510;

bitset<MAXN> dp[MAXN][4], orig[MAXN];
int r, c, m;
string s;
int main(){
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	cin >> r >> c >> m;
	for(int i = 1; i <= r; i ++){
		for(int j = 1; j <= c; j++){
			char c;
			cin >> c;
			if(c == '.') dp[i][1][j] = 1, orig[i][j] = 1;
			
		}
	}
	cin >> s;
	for(int k = 0; k < m; k++ ){
		int p = k%2;
		//printf("%d\n",p );
		for(int i = 1; i <= r; i++){
		
			dp[i][p].reset();
			if(s[k] == '?')dp[i][p] = (dp[i-1][1-p] | dp[i+1][1-p] | dp[i][1-p]<<1 | dp[i][1-p] >> 1);
			if(s[k] == 'N') dp[i][p] = dp[i+1][1-p];
			if(s[k] == 'S') dp[i][p] = dp[i-1][1-p];
			if(s[k] == 'E') dp[i][p] = dp[i][1-p] << 1;
			if(s[k] == 'W') dp[i][p] = dp[i][1-p] >> 1;
			dp[i][p] &= orig[i];
				//printf("%d ", dp[i][j][p]);
 			
 			//printf("\n");
		}
	}
	int ans = 0;
	for(int i = 1; i <= r; i++){
		
			//printf("%d",dp[i][j][1-m%2] );
		ans += dp[i][1-m%2].count();
		
		//printf("\n");
	}
	cout << ans << endl;


}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 34 ms 512 KB Output is correct
23 Correct 35 ms 888 KB Output is correct
24 Correct 35 ms 820 KB Output is correct
25 Correct 41 ms 896 KB Output is correct
26 Correct 34 ms 768 KB Output is correct
27 Correct 41 ms 768 KB Output is correct
28 Correct 42 ms 768 KB Output is correct
29 Correct 42 ms 768 KB Output is correct
30 Correct 41 ms 768 KB Output is correct
31 Correct 40 ms 768 KB Output is correct
32 Correct 49 ms 808 KB Output is correct
33 Correct 48 ms 768 KB Output is correct
34 Correct 55 ms 768 KB Output is correct
35 Correct 45 ms 768 KB Output is correct
36 Correct 47 ms 768 KB Output is correct