Submission #252463

# Submission time Handle Problem Language Result Execution time Memory
252463 2020-07-25T15:53:43 Z Saboon Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 772584 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 20;
const int inf = 1e9;

int c[maxn], r[maxn], p[maxn];
vector<int> g[maxn];

ll dis(int x, int y, int X, int Y){
	return 1ll*(x-X)*(x-X) + 1ll*(y-Y)*(y-Y);
}

int x[maxn], y[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> x[i] >> y[i] >> r[i];
	for (int i = 1; i <= n; i++)
		for (int j = i+1; j <= n; j++)
			if (dis(x[i],y[i],x[j],y[j]) <= 1ll*(r[i]+r[j])*(r[i]+r[j])){
				g[j].push_back(i);
				g[i].push_back(j);
			}
	for (int i = 1; i <= n; i++)
		p[i] = i;
	sort(p+1, p+n+1, [](int a, int b){
		if (r[a] != r[b])
			return r[a] > r[b];
		return a < b;
	});
	for (int za = 1; za <= n; za++){
		int i = p[za];
		if (c[i] != 0)
			continue;
		c[i] = i;
		for (auto j : g[i])
			if (!c[j])
				c[j] = i;
	}
	for (int i = 1; i <= n; i++)
		cout << c[i] << " \n"[i == n];
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 3 ms 2688 KB Output is correct
6 Correct 2 ms 2816 KB Output is correct
7 Correct 3 ms 2816 KB Output is correct
8 Correct 2 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 2 ms 2688 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 2 ms 2688 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 14 ms 6912 KB Output is correct
17 Correct 13 ms 6656 KB Output is correct
18 Correct 14 ms 7040 KB Output is correct
19 Correct 312 ms 136696 KB Output is correct
20 Correct 294 ms 136696 KB Output is correct
21 Correct 260 ms 85752 KB Output is correct
22 Correct 50 ms 2812 KB Output is correct
23 Correct 50 ms 2816 KB Output is correct
24 Correct 50 ms 2808 KB Output is correct
25 Correct 49 ms 2808 KB Output is correct
26 Correct 50 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 81 ms 8500 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Execution timed out 3073 ms 3880 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 97 ms 8496 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 3 ms 2688 KB Output is correct
6 Correct 2 ms 2816 KB Output is correct
7 Correct 3 ms 2816 KB Output is correct
8 Correct 2 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 2 ms 2688 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 2 ms 2688 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 14 ms 6912 KB Output is correct
17 Correct 13 ms 6656 KB Output is correct
18 Correct 14 ms 7040 KB Output is correct
19 Correct 312 ms 136696 KB Output is correct
20 Correct 294 ms 136696 KB Output is correct
21 Correct 260 ms 85752 KB Output is correct
22 Correct 50 ms 2812 KB Output is correct
23 Correct 50 ms 2816 KB Output is correct
24 Correct 50 ms 2808 KB Output is correct
25 Correct 49 ms 2808 KB Output is correct
26 Correct 50 ms 2808 KB Output is correct
27 Correct 1122 ms 383480 KB Output is correct
28 Correct 1196 ms 478840 KB Output is correct
29 Correct 1178 ms 459860 KB Output is correct
30 Correct 189 ms 2936 KB Output is correct
31 Correct 193 ms 3064 KB Output is correct
32 Correct 190 ms 2936 KB Output is correct
33 Execution timed out 3112 ms 772584 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 2 ms 2688 KB Output is correct
5 Correct 3 ms 2688 KB Output is correct
6 Correct 2 ms 2816 KB Output is correct
7 Correct 3 ms 2816 KB Output is correct
8 Correct 2 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 2 ms 2688 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 2 ms 2688 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 14 ms 6912 KB Output is correct
17 Correct 13 ms 6656 KB Output is correct
18 Correct 14 ms 7040 KB Output is correct
19 Correct 312 ms 136696 KB Output is correct
20 Correct 294 ms 136696 KB Output is correct
21 Correct 260 ms 85752 KB Output is correct
22 Correct 50 ms 2812 KB Output is correct
23 Correct 50 ms 2816 KB Output is correct
24 Correct 50 ms 2808 KB Output is correct
25 Correct 49 ms 2808 KB Output is correct
26 Correct 50 ms 2808 KB Output is correct
27 Runtime error 81 ms 8500 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -