Submission #522219

# Submission time Handle Problem Language Result Execution time Memory
522219 2022-02-04T07:35:21 Z blue Nautilus (BOI19_nautilus) C++17
100 / 100
168 ms 704 KB
#include <iostream>
#include <bitset>
#include <algorithm>
using namespace std;

const int mx = 500;
 
int main()
{
	bitset<(mx+2) * (mx+2)> grid, DP0, DP1;
 
	int R, C, M;
	cin >> R >> C >> M;
 
	for(int i = 1; i <= R; i++)
	{
		for(int j = 1; j <= C; j++)
		{
			char c;
			cin >> c;
 
			if(c == '.') 
				grid.set((mx+2) * i + j);
		}
	}
  
	string S;
	cin >> S;
 
	DP0 = grid;
 
	for(char c : S)
	{
		if(c == 'N') DP1 = (DP0 >> (mx+2));
		else if(c == 'S') DP1 = (DP0 << (mx+2));
		else if(c == 'W') DP1 = (DP0 >> 1);
		else if(c == 'E') DP1 = (DP0 << 1);
		else DP1 = (DP0 << (mx+2)) | (DP0 >> (mx+2)) | (DP0 << 1) | (DP0 >> 1);

		DP1 &= grid;
 
		swap(DP0, DP1);
	}
	cout << DP0.count() << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 3 ms 588 KB Output is correct
9 Correct 3 ms 588 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 588 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 4 ms 588 KB Output is correct
15 Correct 4 ms 592 KB Output is correct
16 Correct 3 ms 588 KB Output is correct
17 Correct 4 ms 588 KB Output is correct
18 Correct 4 ms 588 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 592 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 2 ms 588 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 3 ms 588 KB Output is correct
9 Correct 3 ms 588 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 588 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 4 ms 588 KB Output is correct
15 Correct 4 ms 592 KB Output is correct
16 Correct 3 ms 588 KB Output is correct
17 Correct 4 ms 588 KB Output is correct
18 Correct 4 ms 588 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 592 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
22 Correct 87 ms 588 KB Output is correct
23 Correct 90 ms 588 KB Output is correct
24 Correct 86 ms 592 KB Output is correct
25 Correct 100 ms 588 KB Output is correct
26 Correct 98 ms 704 KB Output is correct
27 Correct 129 ms 592 KB Output is correct
28 Correct 131 ms 588 KB Output is correct
29 Correct 145 ms 588 KB Output is correct
30 Correct 129 ms 588 KB Output is correct
31 Correct 132 ms 592 KB Output is correct
32 Correct 162 ms 592 KB Output is correct
33 Correct 163 ms 588 KB Output is correct
34 Correct 168 ms 588 KB Output is correct
35 Correct 163 ms 588 KB Output is correct
36 Correct 161 ms 588 KB Output is correct