답안 #407577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
407577 2021-05-19T03:28:59 Z amunduzbaev 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 16588 KB
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define int long long
#define pii pair<int, int>
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = 3e5+5;
const int M = 5e3+5;
const int mod = 1e9+7;

int n, m, k, a[N];
int rr[N];
pii p[N];

bool cmp(pii a, pii b){
	if(a.ff != b.ff) return a.ff > b.ff;
	return a.ss < b.ss;
}

int sq(int x) { return x * x; }
int dis(int i, int j){ pii a = p[i], b = p[j];
	return sqrt(sq(a.ff - b.ff) + sq(a.ss - b.ss)); }

/*

11
9 9 2
13 2 1

*/

signed main(){
	cin>>n;
	vector<pii> tt;
	for(int i=0;i<n;i++) cin>>p[i].ff>>p[i].ss>>a[i], tt.pb({a[i], i});
	sort(all(tt), cmp);
	for(auto x : tt){
		if(rr[x.ss]) continue;
		for(int i=0;i<n;i++){
			if(rr[i]) continue;
			if(dis(x.ss, i) <= a[x.ss] + a[i]) rr[i] = x.ss+1;
		}
	}
	for(int i=0;i<n;i++) cout<<rr[i]<<"\n";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 8 ms 588 KB Output is correct
20 Correct 11 ms 608 KB Output is correct
21 Correct 8 ms 612 KB Output is correct
22 Correct 100 ms 668 KB Output is correct
23 Correct 99 ms 664 KB Output is correct
24 Correct 107 ms 680 KB Output is correct
25 Correct 102 ms 660 KB Output is correct
26 Correct 102 ms 680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 409 ms 16568 KB Output is correct
2 Correct 409 ms 16588 KB Output is correct
3 Correct 423 ms 16312 KB Output is correct
4 Correct 413 ms 16552 KB Output is correct
5 Execution timed out 3038 ms 14760 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 3072 ms 5216 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3076 ms 14808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 8 ms 588 KB Output is correct
20 Correct 11 ms 608 KB Output is correct
21 Correct 8 ms 612 KB Output is correct
22 Correct 100 ms 668 KB Output is correct
23 Correct 99 ms 664 KB Output is correct
24 Correct 107 ms 680 KB Output is correct
25 Correct 102 ms 660 KB Output is correct
26 Correct 102 ms 680 KB Output is correct
27 Correct 16 ms 900 KB Output is correct
28 Correct 17 ms 868 KB Output is correct
29 Correct 18 ms 844 KB Output is correct
30 Correct 407 ms 920 KB Output is correct
31 Correct 424 ms 896 KB Output is correct
32 Correct 411 ms 1028 KB Output is correct
33 Correct 163 ms 5708 KB Output is correct
34 Correct 161 ms 5660 KB Output is correct
35 Correct 158 ms 5640 KB Output is correct
36 Execution timed out 3062 ms 5232 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 8 ms 588 KB Output is correct
20 Correct 11 ms 608 KB Output is correct
21 Correct 8 ms 612 KB Output is correct
22 Correct 100 ms 668 KB Output is correct
23 Correct 99 ms 664 KB Output is correct
24 Correct 107 ms 680 KB Output is correct
25 Correct 102 ms 660 KB Output is correct
26 Correct 102 ms 680 KB Output is correct
27 Correct 409 ms 16568 KB Output is correct
28 Correct 409 ms 16588 KB Output is correct
29 Correct 423 ms 16312 KB Output is correct
30 Correct 413 ms 16552 KB Output is correct
31 Execution timed out 3038 ms 14760 KB Time limit exceeded
32 Halted 0 ms 0 KB -