Submission #129988

# Submission time Handle Problem Language Result Execution time Memory
129988 2019-07-13T18:07:38 Z TadijaSebez Nautilus (BOI19_nautilus) C++11
100 / 100
364 ms 1324 KB
#include <bits/stdc++.h>
using namespace std;
const int N=505;
const int M=5005;
char s[N][N],op[M];
int main()
{
	int n,m,q;
	scanf("%i %i %i",&n,&m,&q);
	for(int i=0;i<n;i++) scanf("%s",s[i]);
	scanf("%s",op+1);
	bitset<N*N> dp,ok;
	for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(s[i][j]=='.') ok[i*N+j]=1;
	dp=ok;
	for(int i=1;i<=q;i++)
	{
		if(op[i]=='W') dp=dp>>1;
		if(op[i]=='N') dp=dp>>N;
		if(op[i]=='E') dp=dp<<1;
		if(op[i]=='S') dp=dp<<N;
		if(op[i]=='?') dp=(dp>>1)|(dp<<1)|(dp>>N)|(dp<<N);
		dp=dp&ok;
	}
	printf("%i\n",dp.count());
	return 0;
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:24:26: warning: format '%i' expects argument of type 'int', but argument 2 has type 'std::size_t {aka long unsigned int}' [-Wformat=]
  printf("%i\n",dp.count());
                ~~~~~~~~~~^
nautilus.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i %i",&n,&m,&q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++) scanf("%s",s[i]);
                       ~~~~~^~~~~~~~~~~
nautilus.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",op+1);
  ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 4 ms 504 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 4 ms 504 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 4 ms 504 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 4 ms 504 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 6 ms 760 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 7 ms 888 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 6 ms 760 KB Output is correct
12 Correct 8 ms 760 KB Output is correct
13 Correct 8 ms 760 KB Output is correct
14 Correct 8 ms 760 KB Output is correct
15 Correct 8 ms 760 KB Output is correct
16 Correct 8 ms 760 KB Output is correct
17 Correct 9 ms 760 KB Output is correct
18 Correct 10 ms 760 KB Output is correct
19 Correct 10 ms 760 KB Output is correct
20 Correct 9 ms 760 KB Output is correct
21 Correct 9 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 4 ms 504 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 4 ms 504 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 6 ms 760 KB Output is correct
8 Correct 6 ms 760 KB Output is correct
9 Correct 7 ms 888 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 6 ms 760 KB Output is correct
12 Correct 8 ms 760 KB Output is correct
13 Correct 8 ms 760 KB Output is correct
14 Correct 8 ms 760 KB Output is correct
15 Correct 8 ms 760 KB Output is correct
16 Correct 8 ms 760 KB Output is correct
17 Correct 9 ms 760 KB Output is correct
18 Correct 10 ms 760 KB Output is correct
19 Correct 10 ms 760 KB Output is correct
20 Correct 9 ms 760 KB Output is correct
21 Correct 9 ms 760 KB Output is correct
22 Correct 183 ms 1244 KB Output is correct
23 Correct 183 ms 1144 KB Output is correct
24 Correct 179 ms 1272 KB Output is correct
25 Correct 180 ms 1272 KB Output is correct
26 Correct 177 ms 1232 KB Output is correct
27 Correct 278 ms 1144 KB Output is correct
28 Correct 284 ms 1272 KB Output is correct
29 Correct 280 ms 1272 KB Output is correct
30 Correct 288 ms 1272 KB Output is correct
31 Correct 285 ms 1272 KB Output is correct
32 Correct 364 ms 1324 KB Output is correct
33 Correct 360 ms 1144 KB Output is correct
34 Correct 358 ms 1204 KB Output is correct
35 Correct 357 ms 1144 KB Output is correct
36 Correct 360 ms 1272 KB Output is correct