답안 #484406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484406 2021-11-03T09:05:16 Z nickmet2004 Nautilus (BOI19_nautilus) C++11
100 / 100
333 ms 912 KB
#include<bits/stdc++.h>

using namespace std;
const int N = 1505;
int n , m , t;
bitset<1500> row[N];
bitset<1500> dp[N] , d[N];
void J(char c){
    if(c == 'N') for(int i= 1; i <= n; ++i) dp[i] = d[i + 1];
    if(c == 'S') for(int i = 1; i <= n; ++i) dp[i] = d[i - 1];
    if(c == 'E') for(int i= 1; i <= n; ++i) dp[i] = (d[i] << 1);
    if(c == 'W') for(int i= 1; i <= n; ++i) dp[i] = (d[i] >> 1);
    if(c == '?'){
        for(int i= 1; i <= n; ++i){
            dp[i] = d[i + 1];
            dp[i] |= d[i - 1];
            dp[i] |= (d[i]>>1);
            dp[i] |= (d[i] << 1);
        }
    }
    for(int i= 1; i <= n; ++i) dp[i] = dp[i] & row[i];
}
int main (){
    cin >> n >> m >> t;
    for(int i = 1; i <= n; ++i){
        char ch;
        for(int j = 0; j < m; ++j){
            cin >> ch;
            if(ch == '.') dp[i][j] = 1 , row[i][j] = 1;
            else  dp[i][j] = 0 , row[i][j] = 0;
        }
    }
    //for(int i =1; i<= n; ++i) cout << row[i] <<endl;
    string s;
    cin >> s;
    for(int i = 0; i< t; ++i){
        for(int j =1; j <= n; ++j) d[j]=dp[j];
        J(s[i]);
    }
    int ans = 0;
    for(int i = 1; i <= n; ++i) ans += dp[i].count();
    cout << ans;

return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 2 ms 304 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 308 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 2 ms 304 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 2 ms 332 KB Output is correct
22 Correct 188 ms 832 KB Output is correct
23 Correct 187 ms 836 KB Output is correct
24 Correct 217 ms 824 KB Output is correct
25 Correct 205 ms 832 KB Output is correct
26 Correct 179 ms 844 KB Output is correct
27 Correct 277 ms 832 KB Output is correct
28 Correct 254 ms 912 KB Output is correct
29 Correct 257 ms 832 KB Output is correct
30 Correct 309 ms 832 KB Output is correct
31 Correct 250 ms 844 KB Output is correct
32 Correct 301 ms 828 KB Output is correct
33 Correct 314 ms 836 KB Output is correct
34 Correct 302 ms 836 KB Output is correct
35 Correct 333 ms 844 KB Output is correct
36 Correct 322 ms 844 KB Output is correct