답안 #210083

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210083 2020-03-16T14:17:33 Z pavement Nautilus (BOI19_nautilus) C++17
100 / 100
185 ms 856 KB
#include <bits/stdc++.h>
using namespace std;

int N, M, L, T;
char S;
bitset<505> O[505], C1[505], C2[505], C3[505], C4[505], B[2][505];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> M >> L;
	for (int i = 1; i <= N; i++) {
		O[i].reset();
		C1[i].reset();
		C2[i].reset();
		C3[i].reset();
		C4[i].reset();
		B[0][i].reset();
		B[1][i].reset();
	}
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= M; j++) {
			cin >> S;
			B[0][i][j] = O[i][j] = (S == '.');
		}
	for (int k = 1; k <= L; k++) {
		cin >> S;
		if (S == 'N') {
			for (int i = 1; i <= N; i++)
				B[k & 1][i] = B[1 - (k & 1)][i + 1];
		} else if (S == 'S') {
			for (int i = 1; i <= N; i++)
				B[k & 1][i] = B[1 - (k & 1)][i - 1];
		} else if (S == 'E') {
			for (int i = 1; i <= N; i++)
				B[k & 1][i] = B[1 - (k & 1)][i] << 1;
		} else if (S == 'W') {
			for (int i = 1; i <= N; i++)
				B[k & 1][i] = B[1 - (k & 1)][i] >> 1;
		} else {
			for (int i = 1; i <= N; i++)
				C1[i] = B[1 - (k & 1)][i + 1];
			for (int i = 1; i <= N; i++)
				C2[i] = B[1 - (k & 1)][i - 1];
			for (int i = 1; i <= N; i++)
				C3[i] = B[1 - (k & 1)][i] << 1;
			for (int i = 1; i <= N; i++)
				C4[i] = B[1 - (k & 1)][i] >> 1;
			for (int i = 1; i <= N; i++)
				B[k & 1][i] = C1[i] | C2[i] | C3[i] | C4[i];
		}
		for (int i = 1; i <= N; i++)
			B[k & 1][i] &= O[i];
	}
	for (int i = 1; i <= N; i++) T += B[L & 1][i].count();
	cout << T << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 396 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 396 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 380 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 6 ms 396 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 6 ms 380 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 6 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 6 ms 376 KB Output is correct
22 Correct 86 ms 760 KB Output is correct
23 Correct 80 ms 760 KB Output is correct
24 Correct 84 ms 760 KB Output is correct
25 Correct 81 ms 760 KB Output is correct
26 Correct 76 ms 760 KB Output is correct
27 Correct 135 ms 760 KB Output is correct
28 Correct 137 ms 760 KB Output is correct
29 Correct 139 ms 760 KB Output is correct
30 Correct 149 ms 856 KB Output is correct
31 Correct 137 ms 760 KB Output is correct
32 Correct 181 ms 760 KB Output is correct
33 Correct 184 ms 760 KB Output is correct
34 Correct 185 ms 760 KB Output is correct
35 Correct 185 ms 760 KB Output is correct
36 Correct 179 ms 760 KB Output is correct