Submission #970443

# Submission time Handle Problem Language Result Execution time Memory
970443 2024-04-26T14:24:25 Z Aiperiii Nautilus (BOI19_nautilus) C++14
100 / 100
149 ms 1116 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
bitset <505*505> dp,a;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            char x;
            cin>>x;
            if(x=='.')dp[i*(m+2)+j]=a[i*(m+2)+j]=1;
        }
    }
    string s;
    cin>>s;
    for(int i=0;i<k;i++){
        if(s[i]=='W')dp=((dp>>1)&a);
        else if(s[i]=='E')dp=((dp<<1)&a);
        else if(s[i]=='S')dp=((dp<<(m+2))&a);
        else if(s[i]=='N')dp=((dp>>(m+2))&a);
        else dp=(((dp>>(m+2))|(dp<<(m+2))|(dp>>1)|(dp<<1))&a);
    }
    int res=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(dp[i*(m+2)+j])res++;
        }
    }
    cout<<res<<"\n";
}
/*
 
3
0 9
8 1
13 7
 
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 3 ms 604 KB Output is correct
15 Correct 3 ms 604 KB Output is correct
16 Correct 3 ms 604 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 4 ms 720 KB Output is correct
20 Correct 3 ms 716 KB Output is correct
21 Correct 4 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 684 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 3 ms 604 KB Output is correct
15 Correct 3 ms 604 KB Output is correct
16 Correct 3 ms 604 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 4 ms 720 KB Output is correct
20 Correct 3 ms 716 KB Output is correct
21 Correct 4 ms 604 KB Output is correct
22 Correct 70 ms 604 KB Output is correct
23 Correct 73 ms 860 KB Output is correct
24 Correct 71 ms 1020 KB Output is correct
25 Correct 69 ms 860 KB Output is correct
26 Correct 69 ms 992 KB Output is correct
27 Correct 102 ms 856 KB Output is correct
28 Correct 107 ms 1012 KB Output is correct
29 Correct 105 ms 856 KB Output is correct
30 Correct 105 ms 1116 KB Output is correct
31 Correct 107 ms 1000 KB Output is correct
32 Correct 131 ms 860 KB Output is correct
33 Correct 149 ms 856 KB Output is correct
34 Correct 136 ms 988 KB Output is correct
35 Correct 131 ms 860 KB Output is correct
36 Correct 130 ms 856 KB Output is correct