# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
655870 | 2022-11-05T20:20:28 Z | 600Mihnea | Nautilus (BOI19_nautilus) | C++17 | 243 ms | 716 KB |
bool home = 0; bool verbose; #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 500 + 7; int n; int m; int sdim; bitset<N> valid_place[N]; bitset<N> ok[N]; bitset<N> nok[N]; string s; int main() { if (home) { verbose = 1; freopen ("___input___.txt", "r", stdin); } else { verbose = 0; ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); } cin >> n >> m >> sdim; for (int i = 1; i <= n; i++) { string s; cin >> s; for (int j = 1; j <= m; j++) { char ch = s[j - 1]; valid_place[i][j] = (ch == '.'); } } cin >> s; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { ok[i][j] = valid_place[i][j]; } } for (int itp = 0; itp < sdim; itp++) { char ch = s[itp]; for (int i = 1; i <= n; i++) { nok[i] = 0; } if (ch == 'N' || ch == '?') { for (int i = 1; i <= n; i++) { nok[i] |= ok[i + 1]; } } if (ch == 'S' || ch == '?') { for (int i = 1; i <= n; i++) { nok[i] |= ok[i - 1]; } } if (ch == 'E' || ch == '?') { for (int i = 1; i <= n; i++) { nok[i] |= (ok[i] << 1); } } if (ch == 'W' || ch == '?') { for (int i = 1; i <= n; i++) { nok[i] |= (ok[i] >> 1); } } for (int i = 1; i <= n; i++) { ok[i] = nok[i] & valid_place[i]; } } int sol = 0; for (int i = 1; i <= n; i++) { sol += ok[i].count(); } cout << sol << "\n"; return 0; } /** **/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 171 ms | 460 KB | Output is correct |
23 | Correct | 168 ms | 676 KB | Output is correct |
24 | Correct | 179 ms | 668 KB | Output is correct |
25 | Correct | 164 ms | 596 KB | Output is correct |
26 | Correct | 164 ms | 668 KB | Output is correct |
27 | Correct | 212 ms | 684 KB | Output is correct |
28 | Correct | 207 ms | 672 KB | Output is correct |
29 | Correct | 204 ms | 672 KB | Output is correct |
30 | Correct | 207 ms | 596 KB | Output is correct |
31 | Correct | 202 ms | 668 KB | Output is correct |
32 | Correct | 235 ms | 716 KB | Output is correct |
33 | Correct | 243 ms | 668 KB | Output is correct |
34 | Correct | 241 ms | 676 KB | Output is correct |
35 | Correct | 240 ms | 668 KB | Output is correct |
36 | Correct | 238 ms | 596 KB | Output is correct |