답안 #934726

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934726 2024-02-27T21:18:26 Z asdasdqwer Nautilus (BOI19_nautilus) C++14
100 / 100
121 ms 1068 KB
#include <bits/stdc++.h>
using namespace std;

#define int int64_t

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;cin>>n>>m>>k;
    vector<string> s(n);
    for (auto &x:s)cin>>x;

    string dir;cin>>dir;
    vector<bitset<501>> bt(n);
    for (int i=0;i<n;i++) {
        for (int j=0;j<m;j++) {
            if (s[i][j] == '#') {
                bt[i][j] = 0;
            }

            else {
                bt[i][j] = 1;
            }
        }
    }

    vector<bitset<501>> bt2 = bt, bt3(n);

    for (auto x:dir) {
        if (x == 'E' || x == '?') {
            for (int i=0;i<n;i++) {
                bt3[i] |= bt2[i] << 1;
            }
        }

        if (x == 'N' || x == '?') {
            for (int i=1;i<n;i++) {
                bt3[i-1] |= bt2[i];
            }
        }

        if (x == 'W' || x == '?') {
            for (int i=0;i<n;i++) {
                bt3[i] |= bt2[i] >> 1;
            }
        }

        if (x == 'S' || x == '?') {
            for (int i=1;i<n;i++) {
                bt3[i] |= bt2[i-1];
            }
        }

        for (int i=0;i<n;i++) {
            bt3[i] &= bt[i];
        }

        swap(bt2, bt3);

        for (auto &x:bt3) {
            x.reset();
        }
    }

    int res = 0;
    for (auto x:bt2) {
        res += x.count();
    }

    cout<<res<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 496 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 496 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 65 ms 860 KB Output is correct
23 Correct 67 ms 856 KB Output is correct
24 Correct 66 ms 856 KB Output is correct
25 Correct 66 ms 1064 KB Output is correct
26 Correct 66 ms 860 KB Output is correct
27 Correct 94 ms 1064 KB Output is correct
28 Correct 96 ms 1060 KB Output is correct
29 Correct 95 ms 856 KB Output is correct
30 Correct 93 ms 860 KB Output is correct
31 Correct 92 ms 860 KB Output is correct
32 Correct 121 ms 856 KB Output is correct
33 Correct 119 ms 860 KB Output is correct
34 Correct 118 ms 1064 KB Output is correct
35 Correct 115 ms 1068 KB Output is correct
36 Correct 119 ms 1060 KB Output is correct