# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1105365 | 2024-10-26T08:39:31 Z | manhlinh1501 | Nautilus (BOI19_nautilus) | C++17 | 176 ms | 852 KB |
#include<bits/stdc++.h> using namespace std; using i64 = long long; const int MAXN = 505; int N, M, K; bitset<MAXN> a[MAXN]; bitset<MAXN> b[MAXN]; bitset<MAXN> c[MAXN]; void update(char x) { if(x == 'N') { for(int i = 1; i <= N; i++) b[i] = a[i] & b[i + 1]; } if(x == 'S') { for(int i = N; i >= 1; i--) b[i] = a[i] & b[i - 1]; } if(x == 'E') { for(int i = 1; i <= N; i++) b[i] = a[i] & (b[i] << 1); } if(x == 'W') { for(int i = N; i >= 1; i--) b[i] = a[i] & (b[i] >> 1); } if(x == '?') { for(int i = 1; i <= N; i++) c[i] = b[i - 1] | b[i + 1] | (b[i] >> 1) | (b[i] << 1); for(int i = 1; i <= N; i++) b[i] = c[i] & a[i]; } } signed main() { #define task "" if(fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> M >> K; for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { char c = 0; cin >> c; if(c == '.') { a[i].set(j); b[i].set(j); } } } for(int i = 1; i <= K; i++) { char x = 0; cin >> x; update(x); } int ans = 0; for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { if(b[i][j]) ans++; } } cout << ans; return (0 ^ 0); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 2 ms | 336 KB | Output is correct |
9 | Correct | 2 ms | 336 KB | Output is correct |
10 | Correct | 2 ms | 336 KB | Output is correct |
11 | Correct | 2 ms | 336 KB | Output is correct |
12 | Correct | 2 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 492 KB | Output is correct |
14 | Correct | 2 ms | 472 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 2 ms | 336 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 2 ms | 336 KB | Output is correct |
19 | Correct | 2 ms | 336 KB | Output is correct |
20 | Correct | 2 ms | 336 KB | Output is correct |
21 | Correct | 2 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 2 ms | 336 KB | Output is correct |
9 | Correct | 2 ms | 336 KB | Output is correct |
10 | Correct | 2 ms | 336 KB | Output is correct |
11 | Correct | 2 ms | 336 KB | Output is correct |
12 | Correct | 2 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 492 KB | Output is correct |
14 | Correct | 2 ms | 472 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 2 ms | 336 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 2 ms | 336 KB | Output is correct |
19 | Correct | 2 ms | 336 KB | Output is correct |
20 | Correct | 2 ms | 336 KB | Output is correct |
21 | Correct | 2 ms | 336 KB | Output is correct |
22 | Correct | 84 ms | 592 KB | Output is correct |
23 | Correct | 86 ms | 592 KB | Output is correct |
24 | Correct | 83 ms | 592 KB | Output is correct |
25 | Correct | 82 ms | 592 KB | Output is correct |
26 | Correct | 80 ms | 592 KB | Output is correct |
27 | Correct | 132 ms | 592 KB | Output is correct |
28 | Correct | 136 ms | 592 KB | Output is correct |
29 | Correct | 133 ms | 592 KB | Output is correct |
30 | Correct | 134 ms | 592 KB | Output is correct |
31 | Correct | 133 ms | 852 KB | Output is correct |
32 | Correct | 172 ms | 592 KB | Output is correct |
33 | Correct | 169 ms | 592 KB | Output is correct |
34 | Correct | 174 ms | 592 KB | Output is correct |
35 | Correct | 176 ms | 592 KB | Output is correct |
36 | Correct | 169 ms | 592 KB | Output is correct |