Submission #227009

# Submission time Handle Problem Language Result Execution time Memory
227009 2020-04-25T20:52:11 Z luciocf Nautilus (BOI19_nautilus) C++14
66 / 100
1000 ms 896 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 510;
const int maxm = 5e3+10;

bitset<maxn> bs[maxn], ant[maxn], mark[maxn];

char tab[maxn][maxn];
char s[maxm];

int main(void)
{
	int a, b, m;
	scanf("%d %d %d", &a, &b, &m);

	for (int i = 1; i <= a; i++)
	{
		for (int j = 1; j <= b; j++)
		{
			scanf(" %c", &tab[i][j]);

			if (tab[i][j] == '.')
			{
				mark[i][b-j+1] = 1;
				ant[i][b-j+1] = 1;
			}
		}
	}

	for (int i = 1; i <= m; i++)
		scanf(" %c", &s[i]);

	for (int p = 1; p <= m; p++)
	{
		for (int i = 1; i <= a; i++)
		{
			if (s[p] == 'N')
			{
				bs[i] = (ant[i+1] & mark[i]);
			}
			else if (s[p] == 'E')
			{
				bs[i] = ((ant[i] >> 1) & mark[i]);
			}
			else if (s[p] == 'S')
			{
				bs[i] = (ant[i-1] & mark[i]);
			}
			else if (s[p] == 'W')
			{
				bs[i] = ((ant[i] << 1) & mark[i]);
			}
			else
			{
				bs[i] = ((ant[i+1] | ant[i-1] | (ant[i] >> 1) | (ant[i] << 1)) & mark[i]);
			}
		}

		for (int i = 1; i <= a; i++)
			for (int j = 1; j <= b; j++)
				ant[i][j] = bs[i][j];
	}

	int ans = 0;

	for (int i = 1; i <= a; i++)
		ans += bs[i].count();

	printf("%d\n", ans);
}

Compilation message

nautilus.cpp: In function 'int main()':
nautilus.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &a, &b, &m);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
nautilus.cpp:22:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c", &tab[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~~~
nautilus.cpp:33:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c", &s[i]);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 9 ms 416 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 9 ms 416 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 9 ms 384 KB Output is correct
9 Correct 9 ms 384 KB Output is correct
10 Correct 11 ms 384 KB Output is correct
11 Correct 10 ms 384 KB Output is correct
12 Correct 9 ms 384 KB Output is correct
13 Correct 9 ms 384 KB Output is correct
14 Correct 9 ms 384 KB Output is correct
15 Correct 9 ms 384 KB Output is correct
16 Correct 9 ms 384 KB Output is correct
17 Correct 9 ms 468 KB Output is correct
18 Correct 9 ms 384 KB Output is correct
19 Correct 9 ms 384 KB Output is correct
20 Correct 10 ms 384 KB Output is correct
21 Correct 9 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 9 ms 416 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 9 ms 384 KB Output is correct
9 Correct 9 ms 384 KB Output is correct
10 Correct 11 ms 384 KB Output is correct
11 Correct 10 ms 384 KB Output is correct
12 Correct 9 ms 384 KB Output is correct
13 Correct 9 ms 384 KB Output is correct
14 Correct 9 ms 384 KB Output is correct
15 Correct 9 ms 384 KB Output is correct
16 Correct 9 ms 384 KB Output is correct
17 Correct 9 ms 468 KB Output is correct
18 Correct 9 ms 384 KB Output is correct
19 Correct 9 ms 384 KB Output is correct
20 Correct 10 ms 384 KB Output is correct
21 Correct 9 ms 384 KB Output is correct
22 Execution timed out 1085 ms 896 KB Time limit exceeded
23 Halted 0 ms 0 KB -