Submission #814846

# Submission time Handle Problem Language Result Execution time Memory
814846 2023-08-08T10:30:47 Z rainboy Cell Automaton (JOI23_cell) C
4 / 100
9 ms 4436 KB
#include <stdio.h>

#define N	100000
#define T	50
#define X	100

int main() {
	static int xx[N], yy[N], nn[T + 1];
	static char cc[T + 1][X * 2 + 1][X * 2 + 1];
	int n, q, i, t, x, y;

	scanf("%d%d", &n, &q);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &xx[i], &yy[i]);
		cc[0][X + xx[i]][X + yy[i]] = 2;
	}
	nn[0] = n;
	for (t = 1; t <= T; t++)
		for (x = 0; x <= X * 2; x++)
			for (y = 0; y <= X * 2; y++)
				if (cc[t - 1][x][y] > 0)
					cc[t][x][y] = cc[t - 1][x][y] - 1;
				else if (x > 0 && cc[t - 1][x - 1][y] == 2 || y > 0 && cc[t - 1][x][y - 1] == 2 || x < X * 2 && cc[t - 1][x + 1][y] == 2 || y < X * 2 && cc[t - 1][x][y + 1] == 2)
					cc[t][x][y] = 2, nn[t]++;
	while (q--) {
		scanf("%d", &t);
		printf("%d\n", nn[t]);
	}
	return 0;
}

Compilation message

cell.c: In function 'main':
cell.c:23:20: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   23 |     else if (x > 0 && cc[t - 1][x - 1][y] == 2 || y > 0 && cc[t - 1][x][y - 1] == 2 || x < X * 2 && cc[t - 1][x + 1][y] == 2 || y < X * 2 && cc[t - 1][x][y + 1] == 2)
      |              ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
cell.c:23:98: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   23 |     else if (x > 0 && cc[t - 1][x - 1][y] == 2 || y > 0 && cc[t - 1][x][y - 1] == 2 || x < X * 2 && cc[t - 1][x + 1][y] == 2 || y < X * 2 && cc[t - 1][x][y + 1] == 2)
      |                                                                                        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
cell.c:23:139: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   23 |     else if (x > 0 && cc[t - 1][x - 1][y] == 2 || y > 0 && cc[t - 1][x][y - 1] == 2 || x < X * 2 && cc[t - 1][x + 1][y] == 2 || y < X * 2 && cc[t - 1][x][y + 1] == 2)
      |                                                                                                                                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
cell.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
cell.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d%d", &xx[i], &yy[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cell.c:26:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   scanf("%d", &t);
      |   ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1108 KB Output is correct
2 Correct 6 ms 1356 KB Output is correct
3 Correct 6 ms 1876 KB Output is correct
4 Correct 8 ms 1840 KB Output is correct
5 Correct 6 ms 1488 KB Output is correct
6 Correct 6 ms 1616 KB Output is correct
7 Correct 6 ms 1876 KB Output is correct
8 Correct 7 ms 1952 KB Output is correct
9 Correct 8 ms 1876 KB Output is correct
10 Correct 6 ms 1876 KB Output is correct
11 Correct 6 ms 1876 KB Output is correct
12 Correct 7 ms 1976 KB Output is correct
13 Correct 7 ms 1992 KB Output is correct
14 Correct 6 ms 1880 KB Output is correct
15 Correct 6 ms 1912 KB Output is correct
16 Correct 6 ms 980 KB Output is correct
17 Correct 6 ms 980 KB Output is correct
18 Correct 6 ms 980 KB Output is correct
19 Correct 8 ms 980 KB Output is correct
20 Correct 6 ms 980 KB Output is correct
21 Correct 7 ms 1020 KB Output is correct
22 Correct 6 ms 980 KB Output is correct
23 Correct 8 ms 968 KB Output is correct
24 Correct 8 ms 952 KB Output is correct
25 Correct 6 ms 956 KB Output is correct
26 Correct 7 ms 992 KB Output is correct
27 Correct 6 ms 980 KB Output is correct
28 Correct 6 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1108 KB Output is correct
2 Correct 6 ms 1356 KB Output is correct
3 Correct 6 ms 1876 KB Output is correct
4 Correct 8 ms 1840 KB Output is correct
5 Correct 6 ms 1488 KB Output is correct
6 Correct 6 ms 1616 KB Output is correct
7 Correct 6 ms 1876 KB Output is correct
8 Correct 7 ms 1952 KB Output is correct
9 Correct 8 ms 1876 KB Output is correct
10 Correct 6 ms 1876 KB Output is correct
11 Correct 6 ms 1876 KB Output is correct
12 Correct 7 ms 1976 KB Output is correct
13 Correct 7 ms 1992 KB Output is correct
14 Correct 6 ms 1880 KB Output is correct
15 Correct 6 ms 1912 KB Output is correct
16 Correct 6 ms 980 KB Output is correct
17 Correct 6 ms 980 KB Output is correct
18 Correct 6 ms 980 KB Output is correct
19 Correct 8 ms 980 KB Output is correct
20 Correct 6 ms 980 KB Output is correct
21 Correct 7 ms 1020 KB Output is correct
22 Correct 6 ms 980 KB Output is correct
23 Correct 8 ms 968 KB Output is correct
24 Correct 8 ms 952 KB Output is correct
25 Correct 6 ms 956 KB Output is correct
26 Correct 7 ms 992 KB Output is correct
27 Correct 6 ms 980 KB Output is correct
28 Correct 6 ms 980 KB Output is correct
29 Incorrect 7 ms 1108 KB Output isn't correct
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 4436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 4436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1108 KB Output is correct
2 Correct 6 ms 1356 KB Output is correct
3 Correct 6 ms 1876 KB Output is correct
4 Correct 8 ms 1840 KB Output is correct
5 Correct 6 ms 1488 KB Output is correct
6 Correct 6 ms 1616 KB Output is correct
7 Correct 6 ms 1876 KB Output is correct
8 Correct 7 ms 1952 KB Output is correct
9 Correct 8 ms 1876 KB Output is correct
10 Correct 6 ms 1876 KB Output is correct
11 Correct 6 ms 1876 KB Output is correct
12 Correct 7 ms 1976 KB Output is correct
13 Correct 7 ms 1992 KB Output is correct
14 Correct 6 ms 1880 KB Output is correct
15 Correct 6 ms 1912 KB Output is correct
16 Correct 6 ms 980 KB Output is correct
17 Correct 6 ms 980 KB Output is correct
18 Correct 6 ms 980 KB Output is correct
19 Correct 8 ms 980 KB Output is correct
20 Correct 6 ms 980 KB Output is correct
21 Correct 7 ms 1020 KB Output is correct
22 Correct 6 ms 980 KB Output is correct
23 Correct 8 ms 968 KB Output is correct
24 Correct 8 ms 952 KB Output is correct
25 Correct 6 ms 956 KB Output is correct
26 Correct 7 ms 992 KB Output is correct
27 Correct 6 ms 980 KB Output is correct
28 Correct 6 ms 980 KB Output is correct
29 Incorrect 7 ms 1108 KB Output isn't correct
30 Halted 0 ms 0 KB -