Submission #673854

# Submission time Handle Problem Language Result Execution time Memory
673854 2022-12-22T09:39:46 Z Dan4Life Circle selection (APIO18_circle_selection) C++17
7 / 100
3000 ms 39628 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define int long long 
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
using ll = long long;
const int maxn = (int)3e5+10;
const ll LINF = (ll)2e18;
struct circle{
	int x, y, r, i;
};

int n, elim[maxn];
vector<circle> v;

bool intersects(int i, int j){
	int rr = v[i].r+v[j].r;
	int xx = v[i].x-v[j].x;
	int yy = v[i].y-v[j].y;
	return rr*rr>=xx*xx+yy*yy;
}

int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n; v.resize(n); set<pair<int,int>> S;
	for(int i = 0; i < n; i++){
		cin >> v[i].x >> v[i].y >> v[i].r;
		v[i].i=i; elim[i]=-1; S.insert({v[i].x, i});
	}
	sort(all(v), [&](circle a, circle b){
		if(a.r!=b.r) return a.r > b.r;
		return a.i < b.i;
	});
	for(int i = 0; i < n; i++){
		if(elim[v[i].i]!=-1) continue;
		for(int j = i; j < n; j++)
			if(intersects(i,j) and elim[v[j].i]==-1) elim[v[j].i]=v[i].i;
	}
	for(int i = 0; i < n; i++) cout << ++elim[i] << " ";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 4 ms 980 KB Output is correct
20 Correct 4 ms 980 KB Output is correct
21 Correct 4 ms 980 KB Output is correct
22 Correct 32 ms 972 KB Output is correct
23 Correct 33 ms 972 KB Output is correct
24 Correct 33 ms 980 KB Output is correct
25 Correct 33 ms 968 KB Output is correct
26 Correct 32 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 311 ms 33004 KB Output is correct
2 Correct 317 ms 39580 KB Output is correct
3 Correct 356 ms 39304 KB Output is correct
4 Correct 352 ms 39628 KB Output is correct
5 Correct 2916 ms 37304 KB Output is correct
6 Execution timed out 3080 ms 35420 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 3095 ms 10404 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3083 ms 30924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 4 ms 980 KB Output is correct
20 Correct 4 ms 980 KB Output is correct
21 Correct 4 ms 980 KB Output is correct
22 Correct 32 ms 972 KB Output is correct
23 Correct 33 ms 972 KB Output is correct
24 Correct 33 ms 980 KB Output is correct
25 Correct 33 ms 968 KB Output is correct
26 Correct 32 ms 972 KB Output is correct
27 Correct 8 ms 1620 KB Output is correct
28 Correct 7 ms 1620 KB Output is correct
29 Correct 7 ms 1620 KB Output is correct
30 Correct 120 ms 1624 KB Output is correct
31 Correct 122 ms 1620 KB Output is correct
32 Correct 126 ms 1600 KB Output is correct
33 Correct 101 ms 14128 KB Output is correct
34 Correct 83 ms 14148 KB Output is correct
35 Correct 85 ms 14008 KB Output is correct
36 Execution timed out 3058 ms 12932 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 4 ms 980 KB Output is correct
20 Correct 4 ms 980 KB Output is correct
21 Correct 4 ms 980 KB Output is correct
22 Correct 32 ms 972 KB Output is correct
23 Correct 33 ms 972 KB Output is correct
24 Correct 33 ms 980 KB Output is correct
25 Correct 33 ms 968 KB Output is correct
26 Correct 32 ms 972 KB Output is correct
27 Correct 311 ms 33004 KB Output is correct
28 Correct 317 ms 39580 KB Output is correct
29 Correct 356 ms 39304 KB Output is correct
30 Correct 352 ms 39628 KB Output is correct
31 Correct 2916 ms 37304 KB Output is correct
32 Execution timed out 3080 ms 35420 KB Time limit exceeded
33 Halted 0 ms 0 KB -