Submission #834114

# Submission time Handle Problem Language Result Execution time Memory
834114 2023-08-22T10:54:21 Z TheSahib Nautilus (BOI19_nautilus) C++14
100 / 100
149 ms 832 KB
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define oo 1e9
#define pii pair<int, int>

using namespace std;

int n, m, q;
const int MAX = 505;

bitset<MAX * MAX> st, can;

int main()
{
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++)
    {
        string s; cin >> s;
        can[i * (m + 2)] = 0;
        can[(i + 1) * (m + 2) - 1] = 0;
        for (int j = 1; j <= m; j++)
        {
            can[i * (m + 2) + j] = s[j - 1] == '.';
        }
    }
    st = can;
    string s; cin >> s;
    for (int i = 0; i < q; i++)
    {
        if(s[i] == 'W'){
            st >>= 1;
        }
        else if(s[i] == 'S'){
            st <<= m + 2;
        }
        else if(s[i] == 'E'){
            st <<= 1;
        }
        else if(s[i] == 'N'){
            st >>= m + 2;
        }
        else{
            st = (st << 1) | (st >> 1) | (st << (m + 2)) | (st >> (m + 2));
        }
        st &= can;
    }
    cout << st.count() << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 2 ms 528 KB Output is correct
3 Correct 1 ms 528 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 2 ms 528 KB Output is correct
3 Correct 1 ms 528 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 3 ms 524 KB Output is correct
9 Correct 2 ms 532 KB Output is correct
10 Correct 3 ms 528 KB Output is correct
11 Correct 2 ms 524 KB Output is correct
12 Correct 3 ms 468 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 3 ms 528 KB Output is correct
17 Correct 3 ms 488 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 4 ms 472 KB Output is correct
20 Correct 4 ms 468 KB Output is correct
21 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 2 ms 528 KB Output is correct
3 Correct 1 ms 528 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 3 ms 524 KB Output is correct
9 Correct 2 ms 532 KB Output is correct
10 Correct 3 ms 528 KB Output is correct
11 Correct 2 ms 524 KB Output is correct
12 Correct 3 ms 468 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 3 ms 528 KB Output is correct
17 Correct 3 ms 488 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 4 ms 472 KB Output is correct
20 Correct 4 ms 468 KB Output is correct
21 Correct 3 ms 468 KB Output is correct
22 Correct 60 ms 824 KB Output is correct
23 Correct 61 ms 824 KB Output is correct
24 Correct 59 ms 820 KB Output is correct
25 Correct 58 ms 796 KB Output is correct
26 Correct 58 ms 788 KB Output is correct
27 Correct 103 ms 824 KB Output is correct
28 Correct 110 ms 820 KB Output is correct
29 Correct 101 ms 824 KB Output is correct
30 Correct 101 ms 824 KB Output is correct
31 Correct 104 ms 724 KB Output is correct
32 Correct 143 ms 792 KB Output is correct
33 Correct 149 ms 824 KB Output is correct
34 Correct 134 ms 824 KB Output is correct
35 Correct 138 ms 820 KB Output is correct
36 Correct 135 ms 832 KB Output is correct