답안 #125560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125560 2019-07-05T23:51:52 Z eriksuenderhauf Nautilus (BOI19_nautilus) C++11
100 / 100
209 ms 804 KB
#include <bits/stdc++.h>
char str[505][505], qry[5005];
std::bitset<505> dp[505][2], arr[505];

int main() {
	int r, c, m, ans = 0; assert(3==scanf("%d %d %d", &r, &c, &m));
	for (int i = 1; i <= r && 1==scanf("%s", str[i]+1); i++) for (int j = 1; j <= c; j++) if (str[i][j] == '.') dp[i][0][j] = arr[i][j] = 1;
	assert(1==scanf("%s", qry+1));
	for (int i = 1; i <= m; i++) for (int j = 1; j <= r; j++)
		if (qry[i] != '?') dp[j][(i&1)]=(qry[i]=='N'||qry[i]=='S') ? (dp[j+1*(qry[i]=='N'?1:-1)][(i&1)^1] & arr[j]) : ((qry[i]=='E') ? ((dp[j][(i&1)^1]<<1) & arr[j]) : ((dp[j][(i&1)^1]>>1) & arr[j]));
		else dp[j][(i&1)] = (dp[j+1][(i&1)^1] | dp[j-1][(i&1)^1] | (dp[j][(i&1)^1] >> 1) | (dp[j][(i&1)^1] << 1)) & arr[j];
	for (int i = 1; i <= r; i++) ans += dp[i][m&1].count();
	return !printf("%d\n", ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 380 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 380 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 100 ms 760 KB Output is correct
23 Correct 104 ms 804 KB Output is correct
24 Correct 97 ms 632 KB Output is correct
25 Correct 98 ms 704 KB Output is correct
26 Correct 95 ms 632 KB Output is correct
27 Correct 158 ms 632 KB Output is correct
28 Correct 161 ms 712 KB Output is correct
29 Correct 161 ms 632 KB Output is correct
30 Correct 161 ms 744 KB Output is correct
31 Correct 157 ms 684 KB Output is correct
32 Correct 207 ms 740 KB Output is correct
33 Correct 207 ms 632 KB Output is correct
34 Correct 207 ms 740 KB Output is correct
35 Correct 208 ms 632 KB Output is correct
36 Correct 209 ms 632 KB Output is correct