# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
639554 |
2022-09-10T15:31:54 Z |
erto |
Nautilus (BOI19_nautilus) |
C++17 |
|
1000 ms |
620 KB |
#include <bits/stdc++.h>
typedef long long int ll;
#define INF ll(1e9 + 7)
#define INF2 998244353
#define N (ll)(1e5 + 5)
using namespace std;
#define int ll
#define lsb(x) (x & (-x))
int r, c, m, g, h;
string s;
bitset<502> a[502], pos[502], t[502];
int d1[] = {0, 0, 1, -1}, d2[] = {1, - 1, 0, 0};
void solve(){
cin >> r >> c >> m;
for(int i=1; i<=r; i++){
cin >> s;
for(int j=1; j<=c; j++){
a[i][j] = s[j - 1] == '.';
pos[i][j] = a[i][j];
}
}
cin >> s;
for(int i=0; i<m; i++){
if(s[i] == '?'){
for(int n=1; n<=r; n++){
for(int l=1; l<=c; l++){
if(pos[n][l]){
for(int j=0; j<4; j++){
t[n][l] = a[n + d1[j]][l + d2[j]];
if(t[n][l])break;
}
}
}
}
for(int i=1; i<=r; i++){
a[i] = t[i];
t[i] &= 0;
}
}
else if(s[i] == 'W'){
for(int n=1; n<=r; n++){
for(int l=1; l<=c; l++){
if(pos[n][l]){
a[n][l] = a[n][l + 1];
}
}
}
}
else if(s[i] == 'E'){
for(int n=1; n<=r; n++){
for(int l=c; l; l--){
if(pos[n][l]){
a[n][l] = a[n][l - 1];
}
}
}
}
else if(s[i] == 'S'){
for(int n=r; n; n--){
for(int l=1; l<=c; l++){
if(pos[n][l]){
a[n][l] = a[n - 1][l];
}
}
}
}
else{
for(int n=1; n<=r; n++){
for(int l=1; l<=c; l++){
if(pos[n][l]){
a[n][l] = a[n + 1][l];
}
}
}
}
}
int sum = 0;
for(int n=r; n; n--){
for(int l=1; l<=c; l++){
sum += a[n][l];
}
}
cout << sum;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int T = 1;
//cin>>T;
while (T--){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
336 KB |
Output is correct |
5 |
Correct |
3 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
336 KB |
Output is correct |
5 |
Correct |
3 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
7 ms |
340 KB |
Output is correct |
9 |
Correct |
7 ms |
336 KB |
Output is correct |
10 |
Correct |
4 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
4 ms |
340 KB |
Output is correct |
13 |
Correct |
6 ms |
336 KB |
Output is correct |
14 |
Correct |
8 ms |
340 KB |
Output is correct |
15 |
Correct |
6 ms |
340 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
5 ms |
336 KB |
Output is correct |
19 |
Correct |
6 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
360 KB |
Output is correct |
21 |
Correct |
2 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
5 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
336 KB |
Output is correct |
5 |
Correct |
3 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
7 ms |
340 KB |
Output is correct |
9 |
Correct |
7 ms |
336 KB |
Output is correct |
10 |
Correct |
4 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
4 ms |
340 KB |
Output is correct |
13 |
Correct |
6 ms |
336 KB |
Output is correct |
14 |
Correct |
8 ms |
340 KB |
Output is correct |
15 |
Correct |
6 ms |
340 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
5 ms |
336 KB |
Output is correct |
19 |
Correct |
6 ms |
340 KB |
Output is correct |
20 |
Correct |
5 ms |
360 KB |
Output is correct |
21 |
Correct |
2 ms |
336 KB |
Output is correct |
22 |
Execution timed out |
1084 ms |
620 KB |
Time limit exceeded |
23 |
Halted |
0 ms |
0 KB |
- |