Submission #1106075

# Submission time Handle Problem Language Result Execution time Memory
1106075 2024-10-29T07:18:34 Z Andrei_ierdnA Nautilus (BOI19_nautilus) C++17
100 / 100
179 ms 1016 KB
#include <iostream>
#include <bitset>

using namespace std;

const int MAXN = 500;

int n, m, q;
bitset<250505> valid, bs;
char sir[5003];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
        cin >> sir;
        for (int j = 0; j < m; j++) {
            if (sir[j] == '.') {
                valid.set(i*(m+1)+j);
            }
        }
    }
    cin >> sir;
    bs = valid;
    for (int i = 0; i < q; i++) {
        if (sir[i] == 'N') {
            bs >>= m+1;
        }
        else if (sir[i] == 'S') {
            bs <<= m+1;
        }
        else if (sir[i] == 'W') {
            bs >>= 1;
        }
        else if (sir[i] == 'E') {
            bs <<= 1;
        }
        else {
            bs = (bs >> (m+1)) | (bs << (m+1)) | (bs >> 1) | (bs << 1);
        }
        bs &= valid;
    }
    cout << bs.count();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 592 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 2 ms 592 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 592 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 2 ms 592 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 3 ms 592 KB Output is correct
10 Correct 3 ms 764 KB Output is correct
11 Correct 3 ms 592 KB Output is correct
12 Correct 3 ms 592 KB Output is correct
13 Correct 3 ms 592 KB Output is correct
14 Correct 5 ms 592 KB Output is correct
15 Correct 4 ms 592 KB Output is correct
16 Correct 5 ms 592 KB Output is correct
17 Correct 4 ms 592 KB Output is correct
18 Correct 4 ms 764 KB Output is correct
19 Correct 6 ms 592 KB Output is correct
20 Correct 6 ms 592 KB Output is correct
21 Correct 6 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 592 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 2 ms 592 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 2 ms 592 KB Output is correct
9 Correct 3 ms 592 KB Output is correct
10 Correct 3 ms 764 KB Output is correct
11 Correct 3 ms 592 KB Output is correct
12 Correct 3 ms 592 KB Output is correct
13 Correct 3 ms 592 KB Output is correct
14 Correct 5 ms 592 KB Output is correct
15 Correct 4 ms 592 KB Output is correct
16 Correct 5 ms 592 KB Output is correct
17 Correct 4 ms 592 KB Output is correct
18 Correct 4 ms 764 KB Output is correct
19 Correct 6 ms 592 KB Output is correct
20 Correct 6 ms 592 KB Output is correct
21 Correct 6 ms 592 KB Output is correct
22 Correct 63 ms 848 KB Output is correct
23 Correct 63 ms 848 KB Output is correct
24 Correct 61 ms 848 KB Output is correct
25 Correct 61 ms 848 KB Output is correct
26 Correct 59 ms 848 KB Output is correct
27 Correct 171 ms 848 KB Output is correct
28 Correct 109 ms 848 KB Output is correct
29 Correct 106 ms 972 KB Output is correct
30 Correct 119 ms 848 KB Output is correct
31 Correct 103 ms 848 KB Output is correct
32 Correct 140 ms 848 KB Output is correct
33 Correct 179 ms 848 KB Output is correct
34 Correct 142 ms 1016 KB Output is correct
35 Correct 143 ms 848 KB Output is correct
36 Correct 144 ms 848 KB Output is correct