Submission #381140

# Submission time Handle Problem Language Result Execution time Memory
381140 2021-03-24T16:19:12 Z rainboy Circle selection (APIO18_circle_selection) C
7 / 100
3000 ms 14228 KB
#include <stdio.h>

#define N	300000

int main() {
	static int xx[N], yy[N], rr[N], pp[N];
	static char used[N];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d%d%d", &xx[i], &yy[i], &rr[i]);
	while (1) {
		int i_;

		i_ = -1;
		for (i = 0; i < n; i++)
			if (!used[i] && (i_ == -1 || rr[i_] < rr[i]))
				i_ = i;
		if (i_ == -1)
			break;
		for (i = 0; i < n; i++) {
			long long x = xx[i] - xx[i_], y = yy[i] - yy[i_], r = rr[i] + rr[i_];

			if (!used[i] && x * x + y * y <= r * r)
				used[i] = 1, pp[i] = i_;
		}
	}
	for (i = 0; i < n; i++)
		printf("%d ", pp[i] + 1);
	printf("\n");
	return 0;
}

Compilation message

circle_selection.c: In function 'main':
circle_selection.c:10:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   10 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
circle_selection.c:12:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   12 |   scanf("%d%d%d", &xx[i], &yy[i], &rr[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 2 ms 396 KB Output is correct
19 Correct 4 ms 620 KB Output is correct
20 Correct 5 ms 620 KB Output is correct
21 Correct 4 ms 620 KB Output is correct
22 Correct 169 ms 620 KB Output is correct
23 Correct 150 ms 548 KB Output is correct
24 Correct 155 ms 620 KB Output is correct
25 Correct 148 ms 592 KB Output is correct
26 Correct 151 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 156 ms 14228 KB Output is correct
2 Correct 157 ms 14060 KB Output is correct
3 Correct 148 ms 13856 KB Output is correct
4 Correct 150 ms 14188 KB Output is correct
5 Execution timed out 3035 ms 9888 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Execution timed out 3047 ms 4784 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3017 ms 11800 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 2 ms 396 KB Output is correct
19 Correct 4 ms 620 KB Output is correct
20 Correct 5 ms 620 KB Output is correct
21 Correct 4 ms 620 KB Output is correct
22 Correct 169 ms 620 KB Output is correct
23 Correct 150 ms 548 KB Output is correct
24 Correct 155 ms 620 KB Output is correct
25 Correct 148 ms 592 KB Output is correct
26 Correct 151 ms 620 KB Output is correct
27 Correct 6 ms 876 KB Output is correct
28 Correct 6 ms 912 KB Output is correct
29 Correct 6 ms 876 KB Output is correct
30 Correct 680 ms 876 KB Output is correct
31 Correct 648 ms 820 KB Output is correct
32 Correct 664 ms 876 KB Output is correct
33 Correct 52 ms 5756 KB Output is correct
34 Correct 54 ms 5740 KB Output is correct
35 Correct 67 ms 5484 KB Output is correct
36 Execution timed out 3053 ms 4460 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 2 ms 396 KB Output is correct
19 Correct 4 ms 620 KB Output is correct
20 Correct 5 ms 620 KB Output is correct
21 Correct 4 ms 620 KB Output is correct
22 Correct 169 ms 620 KB Output is correct
23 Correct 150 ms 548 KB Output is correct
24 Correct 155 ms 620 KB Output is correct
25 Correct 148 ms 592 KB Output is correct
26 Correct 151 ms 620 KB Output is correct
27 Correct 156 ms 14228 KB Output is correct
28 Correct 157 ms 14060 KB Output is correct
29 Correct 148 ms 13856 KB Output is correct
30 Correct 150 ms 14188 KB Output is correct
31 Execution timed out 3035 ms 9888 KB Time limit exceeded
32 Halted 0 ms 0 KB -