답안 #443580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
443580 2021-07-10T21:57:48 Z JovanB Nautilus (BOI19_nautilus) C++17
100 / 100
60 ms 452 KB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

bitset <500> dpp[505];
bitset <500> dp[505];
bitset <500> rows[505];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, m, k;
    cin >> n >> m >> k;
    for(int i=1; i<=n; i++){
        string s;
        cin >> s;
        for(int j=0; j<m; j++){
            if(s[j] == '.') dp[i][j] = rows[i][j] = 1;
        }
    }
    while(k--){
        for(int i=1; i<=n; i++) dpp[i] = dp[i];
        char c;
        cin >> c;
        if(c == 'W'){
            for(int i=1; i<=n; i++) dp[i] = (dpp[i] >> 1);
        }
        else if(c == 'E'){
            for(int i=1; i<=n; i++) dp[i] = (dpp[i] << 1);
        }
        else if(c == 'N'){
            for(int i=1; i<=n; i++) dp[i] = dpp[i+1];
        }
        else if(c == 'S'){
            for(int i=1; i<=n; i++) dp[i] = dpp[i-1];
        }
        else{
            for(int i=1; i<=n; i++){
                dp[i] = (dpp[i] << 1);
                dp[i] |= (dpp[i] >> 1);
                dp[i] |= dpp[i+1];
                dp[i] |= dpp[i-1];
            }
        }
        for(int i=1; i<=n; i++) dp[i] &= rows[i];
    }
    int res = 0;
    for(int i=1; i<=n; i++){
        res += dp[i].count();
    }
    cout << res << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 34 ms 332 KB Output is correct
23 Correct 35 ms 332 KB Output is correct
24 Correct 37 ms 452 KB Output is correct
25 Correct 35 ms 420 KB Output is correct
26 Correct 34 ms 332 KB Output is correct
27 Correct 42 ms 332 KB Output is correct
28 Correct 45 ms 400 KB Output is correct
29 Correct 43 ms 332 KB Output is correct
30 Correct 43 ms 404 KB Output is correct
31 Correct 42 ms 332 KB Output is correct
32 Correct 51 ms 400 KB Output is correct
33 Correct 49 ms 332 KB Output is correct
34 Correct 60 ms 332 KB Output is correct
35 Correct 49 ms 412 KB Output is correct
36 Correct 48 ms 332 KB Output is correct