Submission #124214

# Submission time Handle Problem Language Result Execution time Memory
124214 2019-07-02T17:42:16 Z tutis Circle selection (APIO18_circle_selection) C++17
7 / 100
3000 ms 18572 KB
/*input
11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1
*/
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	ll x[n], y[n], r[n];
	for (int i = 0; i < n; i++)
		cin >> x[i] >> y[i] >> r[i];
	int a[n];
	iota(a, a + n, 0);
	sort(a, a + n, [&](int x, int y) {
		if (r[x] != r[y])
			return r[x] > r[y];
		else
			return x < y;
	});
	int ans[n];
	fill_n(ans, n, -1);
	for (int i = 0; i < n; i++)
	{
		if (ans[a[i]] != -1)
			continue;
		for (int j = i; j < n; j++)
		{
			if (ans[a[j]] != -1)
				continue;
			if ((x[a[i]] - x[a[j]]) * (x[a[i]] - x[a[j]]) +
			        (y[a[i]] - y[a[j]]) * (y[a[i]] - y[a[j]]) <=
			        (r[a[i]] + r[a[j]]) * (r[a[i]] + r[a[j]]))
			{
				ans[a[j]] = a[i];
			}
		}
	}
	for (int i = 0; i < n; i++)
		cout << ans[i] + 1 << " ";
	cout << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 5 ms 632 KB Output is correct
20 Correct 5 ms 636 KB Output is correct
21 Correct 5 ms 632 KB Output is correct
22 Correct 51 ms 632 KB Output is correct
23 Correct 52 ms 760 KB Output is correct
24 Correct 52 ms 760 KB Output is correct
25 Correct 54 ms 632 KB Output is correct
26 Correct 52 ms 684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 18572 KB Output is correct
2 Correct 203 ms 17164 KB Output is correct
3 Correct 201 ms 17016 KB Output is correct
4 Correct 193 ms 17272 KB Output is correct
5 Execution timed out 3047 ms 14372 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Execution timed out 3012 ms 6296 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3032 ms 17656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 5 ms 632 KB Output is correct
20 Correct 5 ms 636 KB Output is correct
21 Correct 5 ms 632 KB Output is correct
22 Correct 51 ms 632 KB Output is correct
23 Correct 52 ms 760 KB Output is correct
24 Correct 52 ms 760 KB Output is correct
25 Correct 54 ms 632 KB Output is correct
26 Correct 52 ms 684 KB Output is correct
27 Correct 8 ms 1016 KB Output is correct
28 Correct 8 ms 1016 KB Output is correct
29 Correct 8 ms 1016 KB Output is correct
30 Correct 275 ms 988 KB Output is correct
31 Correct 257 ms 888 KB Output is correct
32 Correct 293 ms 1016 KB Output is correct
33 Correct 72 ms 7160 KB Output is correct
34 Correct 71 ms 7132 KB Output is correct
35 Correct 73 ms 7032 KB Output is correct
36 Execution timed out 3034 ms 5924 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 5 ms 632 KB Output is correct
20 Correct 5 ms 636 KB Output is correct
21 Correct 5 ms 632 KB Output is correct
22 Correct 51 ms 632 KB Output is correct
23 Correct 52 ms 760 KB Output is correct
24 Correct 52 ms 760 KB Output is correct
25 Correct 54 ms 632 KB Output is correct
26 Correct 52 ms 684 KB Output is correct
27 Correct 197 ms 18572 KB Output is correct
28 Correct 203 ms 17164 KB Output is correct
29 Correct 201 ms 17016 KB Output is correct
30 Correct 193 ms 17272 KB Output is correct
31 Execution timed out 3047 ms 14372 KB Time limit exceeded
32 Halted 0 ms 0 KB -