Submission #919712

# Submission time Handle Problem Language Result Execution time Memory
919712 2024-02-01T13:53:30 Z ttamx Nautilus (BOI19_nautilus) C++14
100 / 100
152 ms 856 KB
#include<bits/stdc++.h>

using namespace std;

const int N=505;

int r,c,m;
string s;
bitset<N> a[N],dp[N],ndp[N];

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> r >> c >> m;
    for(int i=1;i<=r;i++){
        for(int j=0;j<c;j++){
            char x;
            cin >> x;
            a[i][j]=x=='.';
        }
        dp[i]=a[i];
    }
    cin >> s;
    for(auto x:s){
        for(int i=1;i<=r;i++){
            if(x=='E')ndp[i]=dp[i]<<1;
            if(x=='W')ndp[i]=dp[i]>>1;
            if(x=='N')ndp[i]=dp[i+1];
            if(x=='S')ndp[i]=dp[i-1];
            if(x=='?')ndp[i]=(dp[i]<<1)|(dp[i]>>1)|dp[i+1]|dp[i-1];
        }
        for(int i=1;i<=r;i++)dp[i]=ndp[i]&a[i];
    }
    int ans=0;
    for(int i=1;i<=r;i++)ans+=dp[i].count();
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 544 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 544 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 76 ms 600 KB Output is correct
23 Correct 77 ms 792 KB Output is correct
24 Correct 75 ms 792 KB Output is correct
25 Correct 74 ms 604 KB Output is correct
26 Correct 73 ms 788 KB Output is correct
27 Correct 120 ms 604 KB Output is correct
28 Correct 120 ms 788 KB Output is correct
29 Correct 119 ms 600 KB Output is correct
30 Correct 120 ms 856 KB Output is correct
31 Correct 116 ms 600 KB Output is correct
32 Correct 150 ms 788 KB Output is correct
33 Correct 152 ms 600 KB Output is correct
34 Correct 151 ms 600 KB Output is correct
35 Correct 152 ms 796 KB Output is correct
36 Correct 149 ms 856 KB Output is correct