답안 #390270

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
390270 2021-04-15T18:02:11 Z ritul_kr_singh Nautilus (BOI19_nautilus) C++17
100 / 100
210 ms 528 KB
#pragma GCC optimize("Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' <<
#define nl << '\n'
 
const int sz = 500*500;
 
signed main(){
	cin.tie(0)->sync_with_stdio(0);
	int r, c, m; cin >> r >> c >> m;
	char inp;
 
	bitset<sz> a, b, x, y, g;
	
	for(int i=0; i<r; ++i){
		for(int j=0; j<c; ++j){
			cin >> inp;
			g[i*c+j] = b[i*c+j] = (inp == '.');
			x[i*c+j] = j!=0;
			y[i*c+j] = j!=c-1;
		}
	}
 
	string s; cin >> s;
 
	for(int k=0; k<m; ++k){
		a = b;
		b = bitset<sz>(0);
		if(s[k] == 'S' or s[k] == '?') b |= (a << c);
		if(s[k] == 'N' or s[k] == '?') b |= (a >> c);
		if(s[k] == 'E' or s[k] == '?') b |= (a << 1) & x;
		if(s[k] == 'W' or s[k] == '?') b |= (a >> 1) & y;
		b = b & g;
	}
 
	int res = 0;
	for(int i=0; i<r; ++i)
		for(int j=0; j<c; ++j)
			res += b[i*c+j];
 
	cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 3 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 3 ms 460 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 4 ms 460 KB Output is correct
13 Correct 4 ms 460 KB Output is correct
14 Correct 5 ms 460 KB Output is correct
15 Correct 4 ms 460 KB Output is correct
16 Correct 4 ms 528 KB Output is correct
17 Correct 5 ms 460 KB Output is correct
18 Correct 5 ms 460 KB Output is correct
19 Correct 5 ms 460 KB Output is correct
20 Correct 5 ms 460 KB Output is correct
21 Correct 5 ms 472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 3 ms 460 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 3 ms 460 KB Output is correct
8 Correct 3 ms 460 KB Output is correct
9 Correct 3 ms 460 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 4 ms 460 KB Output is correct
13 Correct 4 ms 460 KB Output is correct
14 Correct 5 ms 460 KB Output is correct
15 Correct 4 ms 460 KB Output is correct
16 Correct 4 ms 528 KB Output is correct
17 Correct 5 ms 460 KB Output is correct
18 Correct 5 ms 460 KB Output is correct
19 Correct 5 ms 460 KB Output is correct
20 Correct 5 ms 460 KB Output is correct
21 Correct 5 ms 472 KB Output is correct
22 Correct 115 ms 516 KB Output is correct
23 Correct 122 ms 512 KB Output is correct
24 Correct 116 ms 516 KB Output is correct
25 Correct 114 ms 460 KB Output is correct
26 Correct 112 ms 460 KB Output is correct
27 Correct 158 ms 512 KB Output is correct
28 Correct 161 ms 516 KB Output is correct
29 Correct 161 ms 512 KB Output is correct
30 Correct 160 ms 516 KB Output is correct
31 Correct 157 ms 460 KB Output is correct
32 Correct 204 ms 516 KB Output is correct
33 Correct 198 ms 512 KB Output is correct
34 Correct 210 ms 516 KB Output is correct
35 Correct 197 ms 520 KB Output is correct
36 Correct 193 ms 460 KB Output is correct