# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
944029 |
2024-03-12T07:14:37 Z |
pcc |
Nautilus (BOI19_nautilus) |
C++17 |
|
139 ms |
856 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 505;
bitset<mxn> dp[2][mxn];
bitset<mxn> mask[mxn];
int N,M,L;
string s;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N>>M>>L;
for(int i = 0;i<N;i++){
string ss;
cin>>ss;
for(int j = 0;j<M;j++){
mask[i][j] = (ss[j] == '#'?0:1);
}
dp[0][i] = mask[i];
}
cin>>s;
bool roll = 0;
for(auto it = s.begin();it != s.end();it++){
roll ^= 1;
for(int i = 0;i<N;i++)dp[roll][i].reset();
if(*it == 'W'||*it == '?'){
for(int i = 0;i<N;i++){
dp[roll][i] |= (dp[roll^1][i]>>1);
}
}
if(*it == 'E'||*it == '?'){
for(int i = 0;i<N;i++){
dp[roll][i] |= (dp[roll^1][i]<<1);
}
}
if(*it == 'N'||*it == '?'){
for(int i = 0;i+1<N;i++){
dp[roll][i] |= dp[roll^1][i+1];
}
}
if(*it == 'S'||*it == '?'){
for(int i = 1;i<N;i++){
dp[roll][i] |= dp[roll^1][i-1];
}
}
for(int i = 0;i<N;i++)dp[roll][i] &= mask[i];
/*
for(int i = 0;i<N;i++){
for(int j = 0;j<M;j++)cout<<(dp[roll][i][j]?1:0);cout<<endl;
}cout<<endl;
*/
}
int ans = 0;
for(int i = 0;i<N;i++){
for(int j = 0;j<M;j++)ans += (dp[roll][i][j]?1:0);
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 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 |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
68 ms |
600 KB |
Output is correct |
23 |
Correct |
68 ms |
600 KB |
Output is correct |
24 |
Correct |
71 ms |
604 KB |
Output is correct |
25 |
Correct |
78 ms |
576 KB |
Output is correct |
26 |
Correct |
79 ms |
800 KB |
Output is correct |
27 |
Correct |
99 ms |
804 KB |
Output is correct |
28 |
Correct |
100 ms |
808 KB |
Output is correct |
29 |
Correct |
100 ms |
804 KB |
Output is correct |
30 |
Correct |
100 ms |
604 KB |
Output is correct |
31 |
Correct |
101 ms |
804 KB |
Output is correct |
32 |
Correct |
125 ms |
800 KB |
Output is correct |
33 |
Correct |
126 ms |
804 KB |
Output is correct |
34 |
Correct |
128 ms |
856 KB |
Output is correct |
35 |
Correct |
139 ms |
604 KB |
Output is correct |
36 |
Correct |
125 ms |
804 KB |
Output is correct |