Submission #103188

# Submission time Handle Problem Language Result Execution time Memory
103188 2019-03-29T07:50:43 Z E869120 Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 13652 KB
#include <iostream>
using namespace std;
#pragma warning (disable: 4996)

long long N, X[1 << 18], Y[1 << 18], R[1 << 18], score[1 << 18];
bool used[1 << 18];

long long dist(int p1, int p2) {
	return (X[p1] - X[p2]) * (X[p1] - X[p2]) + abs(Y[p1] - Y[p2]) * abs(Y[p1] - Y[p2]);
}

int main() {
	scanf("%lld", &N);
	for (int i = 1; i <= N; i++) scanf("%lld%lld%lld", &X[i], &Y[i], &R[i]);

	while (true) {
		int maxn = -1, id = -1;
		for (int i = 1; i <= N; i++) {
			if (used[i] == true) continue;
			if (maxn < R[i]) { maxn = R[i]; id = i; }
		}

		if (id == -1) break;

		for (int i = 1; i <= N; i++) {
			if (used[i] == true) continue;
			if (dist(id, i) <= (R[i] + R[id]) * (R[i] + R[id])) { used[i] = true; score[i] = id; }
		}
	}

	for (int i = 1; i <= N; i++) {
		if (i >= 2) printf(" ");
		printf("%lld", score[i]);
	}
	printf("\n");
	return 0;
}

Compilation message

circle_selection.cpp:3:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &N);
  ~~~~~^~~~~~~~~~~~
circle_selection.cpp:14:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 1; i <= N; i++) scanf("%lld%lld%lld", &X[i], &Y[i], &R[i]);
                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 432 KB Output is correct
17 Correct 3 ms 444 KB Output is correct
18 Correct 4 ms 436 KB Output is correct
19 Correct 6 ms 768 KB Output is correct
20 Correct 5 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 167 ms 688 KB Output is correct
23 Correct 193 ms 700 KB Output is correct
24 Correct 175 ms 704 KB Output is correct
25 Correct 186 ms 732 KB Output is correct
26 Correct 170 ms 688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 12592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 356 KB Output is correct
2 Execution timed out 3073 ms 6380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 142 ms 13652 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 432 KB Output is correct
17 Correct 3 ms 444 KB Output is correct
18 Correct 4 ms 436 KB Output is correct
19 Correct 6 ms 768 KB Output is correct
20 Correct 5 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 167 ms 688 KB Output is correct
23 Correct 193 ms 700 KB Output is correct
24 Correct 175 ms 704 KB Output is correct
25 Correct 186 ms 732 KB Output is correct
26 Correct 170 ms 688 KB Output is correct
27 Correct 9 ms 1024 KB Output is correct
28 Correct 11 ms 1052 KB Output is correct
29 Correct 9 ms 1032 KB Output is correct
30 Correct 771 ms 1024 KB Output is correct
31 Correct 826 ms 1004 KB Output is correct
32 Correct 749 ms 1008 KB Output is correct
33 Correct 72 ms 7260 KB Output is correct
34 Correct 82 ms 7472 KB Output is correct
35 Correct 115 ms 7168 KB Output is correct
36 Execution timed out 3063 ms 6172 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 432 KB Output is correct
17 Correct 3 ms 444 KB Output is correct
18 Correct 4 ms 436 KB Output is correct
19 Correct 6 ms 768 KB Output is correct
20 Correct 5 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 167 ms 688 KB Output is correct
23 Correct 193 ms 700 KB Output is correct
24 Correct 175 ms 704 KB Output is correct
25 Correct 186 ms 732 KB Output is correct
26 Correct 170 ms 688 KB Output is correct
27 Incorrect 171 ms 12592 KB Output isn't correct
28 Halted 0 ms 0 KB -