Submission #929586

# Submission time Handle Problem Language Result Execution time Memory
929586 2024-02-18T06:41:02 Z vjudge1 Nautilus (BOI19_nautilus) C++17
100 / 100
147 ms 1008 KB
#include <bits/stdc++.h>
using namespace std;

#define N 505

int r, c, m;
string s;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
        
 	cin >> r >> c >> m;

 	// bitset<5> tes;
 	// tes.set(3);
 	// cout << tes << " W :" << (tes >> 1) << " E:" << (tes << 1) << "\n";

 	vector<bitset<N>> base(N), thispos(N); 

 	for (int i = 1; i <= r; i++){
 		for (int j = 1; j <= c; j++){
 			char typ;
 			cin >> typ;
 			if (typ == '#') continue;
 			base[i].set(j);
 		}
 	}

 	thispos = base;

 	cin >> s;
 	s = " " + s;

 	for (int i = 1; i <= m; i++){
 		vector<bitset<N>> tmp(N);
 		if (s[i] == '?' || s[i] == 'N'){
 			for (int j = 1; j < r; j++){
 				tmp[j] = thispos[j + 1];
 			}
 		}
 		if (s[i] == '?' || s[i] == 'E'){
 			for (int j = 1; j <= r; j++){
 				tmp[j] |= (thispos[j] << 1);
 			}
 		}	
 		if (s[i] == '?' || s[i] == 'S'){
 			for (int j = 2; j <= r; j++){
 				tmp[j] |= thispos[j - 1];
 			}
 		}
 		if (s[i] == '?' || s[i] == 'W'){
 			for (int j = 1; j <= r; j++){
 				tmp[j] |= (thispos[j] >> 1);
 			}
 		}
 		for (int j = 1; j <= r; j++) thispos[j] = (tmp[j] & base[j]);
 	}

 	int res = 0;
 	for (int i = 1; i <= r; i++) res += thispos[i].count();
 	cout << res;

    return 0;
}     
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 500 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 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 344 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 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 464 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 500 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 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 344 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 2 ms 348 KB Output is correct
22 Correct 82 ms 792 KB Output is correct
23 Correct 82 ms 788 KB Output is correct
24 Correct 85 ms 848 KB Output is correct
25 Correct 84 ms 600 KB Output is correct
26 Correct 86 ms 600 KB Output is correct
27 Correct 112 ms 856 KB Output is correct
28 Correct 120 ms 788 KB Output is correct
29 Correct 117 ms 792 KB Output is correct
30 Correct 113 ms 600 KB Output is correct
31 Correct 110 ms 792 KB Output is correct
32 Correct 147 ms 884 KB Output is correct
33 Correct 135 ms 792 KB Output is correct
34 Correct 136 ms 604 KB Output is correct
35 Correct 137 ms 1008 KB Output is correct
36 Correct 143 ms 804 KB Output is correct