Submission #167686

# Submission time Handle Problem Language Result Execution time Memory
167686 2019-12-09T15:33:22 Z tinjyu Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 32852 KB
#include <iostream>
#include <cmath>
using namespace std;
long long int k[300005],n,x[500005],y[500005],ri[500005],id[500005],tmp[500005][4],tag[500005],ans[500005];
int qs(int s,int e)
{
	int l=s,mid=(s+e)/2,r=mid+1,p=l;
	if(mid>s)qs(s,mid);
	if(e>mid+1)qs(mid+1,e);
	while(l<=mid && r<=e)
	{
		if(ri[l]>ri[r] || (ri[l]==ri[r] && id[l]<id[r]))
		{
			tmp[p][0]=x[l];
			tmp[p][1]=y[l];
			tmp[p][2]=ri[l];
			tmp[p][3]=id[l];
			l++;
			p++;
		}
		else
		{
			tmp[p][0]=x[r];
			tmp[p][1]=y[r];
			tmp[p][2]=ri[r];
			tmp[p][3]=id[r];
			r++;
			p++;
		}
	}
	while(l<=mid)
	{
		tmp[p][0]=x[l];
		tmp[p][1]=y[l];
		tmp[p][2]=ri[l];
		tmp[p][3]=id[l];
		l++;
		p++;
	}
	while(r<=e)
	{
		tmp[p][0]=x[r];
		tmp[p][1]=y[r];
		tmp[p][2]=ri[r];
		tmp[p][3]=id[r];
		p++;
		r++;
	}
	
	for(int i=s;i<=e;i++)
	{
		x[i]=tmp[i][0];
		y[i]=tmp[i][1];
		ri[i]=tmp[i][2];
		id[i]=tmp[i][3];
	}
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x[i]>>y[i]>>ri[i];
		id[i]=i;
	}
	qs(1,n);
	for(int i=1;i<=n;i++)
	{
		if(tag[i]==1)continue;
		ans[id[i]]=id[i];
		tag[i]=1;
		for(int j=1;j<=n;j++)
		{
			if(tag[j]==1 || sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))>(ri[i]+ri[j]))continue;
			ans[id[j]]=id[i];
			tag[j]=1;
		}
	}
	for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
}

Compilation message

circle_selection.cpp: In function 'int qs(int, int)':
circle_selection.cpp:57:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 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 376 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 376 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 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 4 ms 504 KB Output is correct
19 Correct 15 ms 1016 KB Output is correct
20 Correct 15 ms 988 KB Output is correct
21 Correct 15 ms 1016 KB Output is correct
22 Correct 136 ms 1016 KB Output is correct
23 Correct 135 ms 888 KB Output is correct
24 Correct 135 ms 1020 KB Output is correct
25 Correct 134 ms 988 KB Output is correct
26 Correct 137 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 648 ms 32852 KB Output is correct
2 Correct 642 ms 32656 KB Output is correct
3 Correct 651 ms 32488 KB Output is correct
4 Correct 644 ms 32808 KB Output is correct
5 Execution timed out 3039 ms 28548 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Execution timed out 3037 ms 10736 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3039 ms 27388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 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 376 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 376 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 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 4 ms 504 KB Output is correct
19 Correct 15 ms 1016 KB Output is correct
20 Correct 15 ms 988 KB Output is correct
21 Correct 15 ms 1016 KB Output is correct
22 Correct 136 ms 1016 KB Output is correct
23 Correct 135 ms 888 KB Output is correct
24 Correct 135 ms 1020 KB Output is correct
25 Correct 134 ms 988 KB Output is correct
26 Correct 137 ms 888 KB Output is correct
27 Correct 30 ms 1528 KB Output is correct
28 Correct 27 ms 1596 KB Output is correct
29 Correct 29 ms 1488 KB Output is correct
30 Correct 509 ms 1540 KB Output is correct
31 Correct 509 ms 1532 KB Output is correct
32 Correct 511 ms 1528 KB Output is correct
33 Correct 268 ms 11896 KB Output is correct
34 Correct 269 ms 12024 KB Output is correct
35 Correct 265 ms 11896 KB Output is correct
36 Execution timed out 3051 ms 10208 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 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 376 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 376 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 5 ms 504 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 4 ms 504 KB Output is correct
19 Correct 15 ms 1016 KB Output is correct
20 Correct 15 ms 988 KB Output is correct
21 Correct 15 ms 1016 KB Output is correct
22 Correct 136 ms 1016 KB Output is correct
23 Correct 135 ms 888 KB Output is correct
24 Correct 135 ms 1020 KB Output is correct
25 Correct 134 ms 988 KB Output is correct
26 Correct 137 ms 888 KB Output is correct
27 Correct 648 ms 32852 KB Output is correct
28 Correct 642 ms 32656 KB Output is correct
29 Correct 651 ms 32488 KB Output is correct
30 Correct 644 ms 32808 KB Output is correct
31 Execution timed out 3039 ms 28548 KB Time limit exceeded
32 Halted 0 ms 0 KB -