답안 #138612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
138612 2019-07-30T07:19:06 Z FedericoS 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 23828 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;

int N;
ll X[300005],Y[300005],R[300005];
ll A[300005],P[300005];
vector<pll> V;

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>X[i]>>Y[i]>>R[i];
		V.push_back({-R[i],i});
	}
	sort(V.begin(),V.end());
	for(int i=0;i<N;i++)
		P[i]=V[i].second;

	//for(int i=0;i<N;i++)cout<<P[i]+1<<" ";cout<<endl;

	for(int i=0;i<N;i++)
		for(int j=i+1;j<N;j++)
			if(
				(X[P[i]]-X[P[j]])*(X[P[i]]-X[P[j]])+
				(Y[P[i]]-Y[P[j]])*(Y[P[i]]-Y[P[j]])<=
				(R[P[i]]+R[P[j]])*(R[P[i]]+R[P[j]])
				and !A[P[j]] and !A[P[i]]
			)
				A[P[j]]=P[i]+1;

	for(int i=0;i<N;i++)
		cout<<(A[i]?A[i]:(i+1))<<" ";

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 380 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 380 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 7 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 65 ms 888 KB Output is correct
20 Correct 60 ms 888 KB Output is correct
21 Correct 110 ms 892 KB Output is correct
22 Correct 58 ms 888 KB Output is correct
23 Correct 47 ms 888 KB Output is correct
24 Correct 54 ms 888 KB Output is correct
25 Correct 49 ms 888 KB Output is correct
26 Correct 48 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3028 ms 23828 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Execution timed out 3020 ms 8440 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3070 ms 22448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 380 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 380 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 7 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 65 ms 888 KB Output is correct
20 Correct 60 ms 888 KB Output is correct
21 Correct 110 ms 892 KB Output is correct
22 Correct 58 ms 888 KB Output is correct
23 Correct 47 ms 888 KB Output is correct
24 Correct 54 ms 888 KB Output is correct
25 Correct 49 ms 888 KB Output is correct
26 Correct 48 ms 888 KB Output is correct
27 Correct 438 ms 1404 KB Output is correct
28 Correct 351 ms 1496 KB Output is correct
29 Correct 390 ms 1396 KB Output is correct
30 Correct 221 ms 1376 KB Output is correct
31 Correct 217 ms 1368 KB Output is correct
32 Correct 195 ms 1268 KB Output is correct
33 Execution timed out 3039 ms 9208 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 380 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 380 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 7 ms 376 KB Output is correct
17 Correct 7 ms 376 KB Output is correct
18 Correct 6 ms 376 KB Output is correct
19 Correct 65 ms 888 KB Output is correct
20 Correct 60 ms 888 KB Output is correct
21 Correct 110 ms 892 KB Output is correct
22 Correct 58 ms 888 KB Output is correct
23 Correct 47 ms 888 KB Output is correct
24 Correct 54 ms 888 KB Output is correct
25 Correct 49 ms 888 KB Output is correct
26 Correct 48 ms 888 KB Output is correct
27 Execution timed out 3028 ms 23828 KB Time limit exceeded
28 Halted 0 ms 0 KB -