답안 #713006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713006 2023-03-20T19:16:50 Z lukameladze Nautilus (BOI19_nautilus) C++14
100 / 100
178 ms 976 KB
# include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
// #define int long long
#define free fre
#define pii pair <int, int>
#define pb push_back
const int N = 3e5 + 5;
int t,n,m,k;
bitset < 505 * 505 > dp, free;
// 
main() {
	cin>>n>>m>>k;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			char ch; cin>>ch;
			if (ch == '.') {
				dp[(i - 1) * (m + 2) + j] = 1;
				free[(i - 1) * (m + 2) + j] = 1;
			}
		}
	}
	string s; cin>>s; 
	s = "@" + s;
	for (int i = 1; i <= k; i++) {
		char ch = s[i];
		if (ch == 'E') {
			dp = (dp << 1) & free;
		} else if (ch == 'W') {
			dp = (dp >> 1) & free;
		} else if (ch == 'S') {
			dp = (dp << (m + 2)) & free;
		} else if (ch == 'N') {
			dp = (dp >> (m + 2)) & free;
		} else dp = ((dp << 1) | (dp >> 1) | (dp << (m + 2)) | (dp >> (m + 2))) & free;
	}
	/*for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (dp[(i - 1) * (m + 2) + j]) cout<<1;else cout<<0;
		}
		cout<<"\n";
	}*/
	cout<<dp.count()<<"\n";
}

Compilation message

nautilus.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 556 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 556 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 3 ms 564 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 3 ms 620 KB Output is correct
10 Correct 3 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 4 ms 556 KB Output is correct
13 Correct 4 ms 596 KB Output is correct
14 Correct 4 ms 596 KB Output is correct
15 Correct 4 ms 596 KB Output is correct
16 Correct 4 ms 596 KB Output is correct
17 Correct 5 ms 556 KB Output is correct
18 Correct 5 ms 596 KB Output is correct
19 Correct 5 ms 556 KB Output is correct
20 Correct 5 ms 596 KB Output is correct
21 Correct 5 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 556 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 596 KB Output is correct
7 Correct 3 ms 564 KB Output is correct
8 Correct 3 ms 596 KB Output is correct
9 Correct 3 ms 620 KB Output is correct
10 Correct 3 ms 596 KB Output is correct
11 Correct 3 ms 596 KB Output is correct
12 Correct 4 ms 556 KB Output is correct
13 Correct 4 ms 596 KB Output is correct
14 Correct 4 ms 596 KB Output is correct
15 Correct 4 ms 596 KB Output is correct
16 Correct 4 ms 596 KB Output is correct
17 Correct 5 ms 556 KB Output is correct
18 Correct 5 ms 596 KB Output is correct
19 Correct 5 ms 556 KB Output is correct
20 Correct 5 ms 596 KB Output is correct
21 Correct 5 ms 468 KB Output is correct
22 Correct 96 ms 928 KB Output is correct
23 Correct 95 ms 892 KB Output is correct
24 Correct 90 ms 976 KB Output is correct
25 Correct 93 ms 892 KB Output is correct
26 Correct 95 ms 788 KB Output is correct
27 Correct 140 ms 924 KB Output is correct
28 Correct 141 ms 848 KB Output is correct
29 Correct 138 ms 880 KB Output is correct
30 Correct 137 ms 880 KB Output is correct
31 Correct 135 ms 868 KB Output is correct
32 Correct 170 ms 852 KB Output is correct
33 Correct 178 ms 860 KB Output is correct
34 Correct 176 ms 852 KB Output is correct
35 Correct 178 ms 852 KB Output is correct
36 Correct 174 ms 724 KB Output is correct