답안 #404044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
404044 2021-05-13T17:16:47 Z fvogel499 Nautilus (BOI19_nautilus) C++14
100 / 100
233 ms 632 KB
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <queue>
#include <cstring>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>

using namespace std;

#define pii pair<int, int>
#define f first
#define s second

#define ll long long
#define rint int32_t

rint main() {
    cin.tie(0);
    // ios_base::sync_with_stdio(0);

    int height, width, seqLength;
    cin >> height >> width >> seqLength;

    bitset<500> grid [height];
    for (int i = 0; i < height; i++) grid[i] = bitset<500>(0);
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            char l;
            cin >> l;
            if (l == '.') grid[i][j] = 1;
        }
    }

    bitset<500> prev [height];
    for (int i = 0; i < height; i++) prev[i] = grid[i];
    for (int _ = 0; _ < seqLength; _++) {
        bitset<500> cur [height];
        for (int i = 0; i < height; i++) cur[i] = bitset<500>(0);
        char l;
        cin >> l;
        if (l == '?') {
            for (int i = 0; i < height; i++) {
                cur[i] = (prev[i]<<1);
                cur[i] |= (prev[i]>>1);
                if (i > 0) cur[i] |= prev[i-1];
                if (i < height-1) cur[i] |= prev[i+1];
                cur[i] &= grid[i];
            }
        }
        else if (l == 'S') for (int i = 1; i < height; i++) cur[i] = prev[i-1]&grid[i];
        else if (l == 'N') for (int i = 0; i < height-1; i++) cur[i] = prev[i+1]&grid[i];
        else if (l == 'E') for (int i = 0; i < height; i++) cur[i] = (prev[i]<<1)&grid[i];
        else if (l == 'W') for (int i = 0; i < height; i++) cur[i] = (prev[i]>>1)&grid[i];
        for (int i = 0; i < height; i++) prev[i] = cur[i];
    }

    int pos = 0;
    for (int i = 0; i < height; i++) pos += prev[i].count();

    cout << pos;

    int d = 0;
    d++;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 312 KB Output is correct
2 Correct 2 ms 300 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 312 KB Output is correct
2 Correct 2 ms 300 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 296 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 2 ms 300 KB Output is correct
15 Correct 2 ms 204 KB Output is correct
16 Correct 2 ms 300 KB Output is correct
17 Correct 3 ms 204 KB Output is correct
18 Correct 3 ms 204 KB Output is correct
19 Correct 3 ms 300 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 312 KB Output is correct
2 Correct 2 ms 300 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 296 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 2 ms 300 KB Output is correct
15 Correct 2 ms 204 KB Output is correct
16 Correct 2 ms 300 KB Output is correct
17 Correct 3 ms 204 KB Output is correct
18 Correct 3 ms 204 KB Output is correct
19 Correct 3 ms 300 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 2 ms 204 KB Output is correct
22 Correct 176 ms 604 KB Output is correct
23 Correct 169 ms 632 KB Output is correct
24 Correct 170 ms 608 KB Output is correct
25 Correct 162 ms 588 KB Output is correct
26 Correct 163 ms 608 KB Output is correct
27 Correct 192 ms 604 KB Output is correct
28 Correct 198 ms 608 KB Output is correct
29 Correct 209 ms 612 KB Output is correct
30 Correct 233 ms 608 KB Output is correct
31 Correct 192 ms 604 KB Output is correct
32 Correct 222 ms 608 KB Output is correct
33 Correct 222 ms 612 KB Output is correct
34 Correct 230 ms 588 KB Output is correct
35 Correct 218 ms 588 KB Output is correct
36 Correct 220 ms 588 KB Output is correct