Submission #226917

# Submission time Handle Problem Language Result Execution time Memory
226917 2020-04-25T17:20:33 Z Pajaraja Nautilus (BOI19_nautilus) C++17
100 / 100
249 ms 1144 KB
#include <bits/stdc++.h>
#define MAXN 507
using namespace std;
bitset<MAXN*MAXN> bs,tr;
int n,m,p;
int main()
{
	cin>>n>>m>>p;
	string s;
	for(int i=0;i<m+2;i++) bs[i]=0;
	for(int i=0;i<m+2;i++) bs[(n+1)*(m+2)+i]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>s;
		bs[i*(m+2)]=bs[i*(m+2)+m+1]=0;
		for(int j=1;j<=m;j++) {if(s[j-1]=='#') bs[i*(m+2)+j]=0; else bs[i*(m+2)+j]=1;}
	}
	cin>>s;
	tr=bs;
	for(int ttt=0;ttt<p;ttt++)
	{
		if(s[ttt]=='S') tr=bs&(tr<<(m+2));
		if(s[ttt]=='N') tr=bs&(tr>>(m+2));
		if(s[ttt]=='E') tr=bs&(tr<<1);
		if(s[ttt]=='W') tr=bs&(tr>>1);
		if(s[ttt]=='?') tr=bs&((tr>>1)|(tr<<1)|tr>>(m+2)|tr<<(m+2));
	}
	int res=0;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(tr[i*(m+2)+j]) res++;
	cout<<res;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 6 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 6 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 640 KB Output is correct
7 Correct 7 ms 768 KB Output is correct
8 Correct 8 ms 768 KB Output is correct
9 Correct 8 ms 768 KB Output is correct
10 Correct 8 ms 768 KB Output is correct
11 Correct 8 ms 768 KB Output is correct
12 Correct 8 ms 768 KB Output is correct
13 Correct 9 ms 768 KB Output is correct
14 Correct 9 ms 768 KB Output is correct
15 Correct 9 ms 768 KB Output is correct
16 Correct 9 ms 768 KB Output is correct
17 Correct 10 ms 640 KB Output is correct
18 Correct 10 ms 640 KB Output is correct
19 Correct 10 ms 640 KB Output is correct
20 Correct 10 ms 640 KB Output is correct
21 Correct 10 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 512 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Correct 6 ms 512 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 6 ms 640 KB Output is correct
7 Correct 7 ms 768 KB Output is correct
8 Correct 8 ms 768 KB Output is correct
9 Correct 8 ms 768 KB Output is correct
10 Correct 8 ms 768 KB Output is correct
11 Correct 8 ms 768 KB Output is correct
12 Correct 8 ms 768 KB Output is correct
13 Correct 9 ms 768 KB Output is correct
14 Correct 9 ms 768 KB Output is correct
15 Correct 9 ms 768 KB Output is correct
16 Correct 9 ms 768 KB Output is correct
17 Correct 10 ms 640 KB Output is correct
18 Correct 10 ms 640 KB Output is correct
19 Correct 10 ms 640 KB Output is correct
20 Correct 10 ms 640 KB Output is correct
21 Correct 10 ms 640 KB Output is correct
22 Correct 130 ms 1024 KB Output is correct
23 Correct 136 ms 1092 KB Output is correct
24 Correct 129 ms 1024 KB Output is correct
25 Correct 136 ms 1024 KB Output is correct
26 Correct 130 ms 1024 KB Output is correct
27 Correct 190 ms 1144 KB Output is correct
28 Correct 197 ms 1024 KB Output is correct
29 Correct 190 ms 1024 KB Output is correct
30 Correct 200 ms 1144 KB Output is correct
31 Correct 189 ms 1024 KB Output is correct
32 Correct 247 ms 1016 KB Output is correct
33 Correct 249 ms 896 KB Output is correct
34 Correct 241 ms 896 KB Output is correct
35 Correct 245 ms 896 KB Output is correct
36 Correct 231 ms 896 KB Output is correct