Submission #203724

# Submission time Handle Problem Language Result Execution time Memory
203724 2020-02-22T01:26:21 Z Segtree Circle selection (APIO18_circle_selection) C++14
7 / 100
85 ms 1528 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define N 5010
ll n,x[N],y[N],r[N];
struct en{
	ll rad,id;
	bool operator<(const en&key)const{
		if(this->rad==key.rad)return this->id<key.id;
		return this->rad>key.rad;
	}
};
ll par[N];
int main(){
	cin>>n;
	vector<en> v;
	rep(i,n){
		cin>>x[i]>>y[i]>>r[i];
		v.push_back((struct en){r[i],i});
	}
	sort(v.begin(),v.end());
	rep(i,n)par[i]=-1;
	for(auto e:v){
		if(par[e.id]>=0)continue;
		rep(i,n)if(par[i]==-1){
			ll dx=x[i]-x[e.id]; dx*=dx;
			ll dy=y[i]-y[e.id]; dy*=dy;
			ll dr=r[i]+r[e.id]; dr*=dr;
			if(dx+dy<=dr)par[i]=e.id;
		}
	}
	rep(i,n)cout<<par[i]+1<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 5 ms 368 KB Output is correct
16 Correct 9 ms 376 KB Output is correct
17 Correct 9 ms 376 KB Output is correct
18 Correct 9 ms 376 KB Output is correct
19 Correct 24 ms 892 KB Output is correct
20 Correct 24 ms 888 KB Output is correct
21 Correct 25 ms 888 KB Output is correct
22 Correct 85 ms 888 KB Output is correct
23 Correct 85 ms 888 KB Output is correct
24 Correct 82 ms 888 KB Output is correct
25 Correct 80 ms 888 KB Output is correct
26 Correct 84 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Runtime error 15 ms 1528 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 1528 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 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 5 ms 368 KB Output is correct
16 Correct 9 ms 376 KB Output is correct
17 Correct 9 ms 376 KB Output is correct
18 Correct 9 ms 376 KB Output is correct
19 Correct 24 ms 892 KB Output is correct
20 Correct 24 ms 888 KB Output is correct
21 Correct 25 ms 888 KB Output is correct
22 Correct 85 ms 888 KB Output is correct
23 Correct 85 ms 888 KB Output is correct
24 Correct 82 ms 888 KB Output is correct
25 Correct 80 ms 888 KB Output is correct
26 Correct 84 ms 888 KB Output is correct
27 Runtime error 16 ms 1404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 380 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 6 ms 376 KB Output is correct
15 Correct 5 ms 368 KB Output is correct
16 Correct 9 ms 376 KB Output is correct
17 Correct 9 ms 376 KB Output is correct
18 Correct 9 ms 376 KB Output is correct
19 Correct 24 ms 892 KB Output is correct
20 Correct 24 ms 888 KB Output is correct
21 Correct 25 ms 888 KB Output is correct
22 Correct 85 ms 888 KB Output is correct
23 Correct 85 ms 888 KB Output is correct
24 Correct 82 ms 888 KB Output is correct
25 Correct 80 ms 888 KB Output is correct
26 Correct 84 ms 888 KB Output is correct
27 Incorrect 13 ms 1016 KB Output isn't correct
28 Halted 0 ms 0 KB -