답안 #111810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111810 2019-05-16T08:50:18 Z b2563125 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 17452 KB
#include<iostream>
#include<vector>
#include<algorithm>
#define vel vector<long long>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pin pair<int,int>
#define mkp make_pair
#define sor(v) sort(v.begin(),v.end())
#define int long long
int sq(int n) { return n * n; }
int dist(vel &x, vel &y, int i, int j) {
	return sq(x[i] - x[j]) + sq(y[i] - y[j]);
}
signed main() {
	int n; cin >> n;
	vel x(n), y(n), r(n);
	vector<pin> al(n);
	rep(i, n) { cin >> x[i] >> y[i] >> r[i]; al[i] = mkp(-r[i], i); }
	vector<bool> is_kled(n, false);
	vel ans(n);
	sor(al);
	rep(i, n) {
		int ri = al[i].second;
		if (!is_kled[ri]) {
			rep(j, n) {
				if (!is_kled[j] and (dist(x, y, ri, j) <= sq(r[ri] + r[j]) )) {
					ans[j] = ri;
					is_kled[j] = true;
				}
			}
		}
	}
	rep(i, n) { cout << ans[i]+1<<endl; }
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 16 ms 768 KB Output is correct
20 Correct 16 ms 768 KB Output is correct
21 Correct 17 ms 640 KB Output is correct
22 Correct 125 ms 700 KB Output is correct
23 Correct 127 ms 732 KB Output is correct
24 Correct 131 ms 640 KB Output is correct
25 Correct 138 ms 640 KB Output is correct
26 Correct 141 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1038 ms 17452 KB Output is correct
2 Correct 826 ms 17328 KB Output is correct
3 Correct 787 ms 17052 KB Output is correct
4 Correct 824 ms 17388 KB Output is correct
5 Execution timed out 3098 ms 15224 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Execution timed out 3033 ms 5752 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3006 ms 15144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 16 ms 768 KB Output is correct
20 Correct 16 ms 768 KB Output is correct
21 Correct 17 ms 640 KB Output is correct
22 Correct 125 ms 700 KB Output is correct
23 Correct 127 ms 732 KB Output is correct
24 Correct 131 ms 640 KB Output is correct
25 Correct 138 ms 640 KB Output is correct
26 Correct 141 ms 640 KB Output is correct
27 Correct 50 ms 1196 KB Output is correct
28 Correct 40 ms 1144 KB Output is correct
29 Correct 43 ms 1152 KB Output is correct
30 Correct 516 ms 1100 KB Output is correct
31 Correct 478 ms 1144 KB Output is correct
32 Correct 476 ms 1272 KB Output is correct
33 Correct 282 ms 7676 KB Output is correct
34 Correct 322 ms 7396 KB Output is correct
35 Correct 376 ms 7648 KB Output is correct
36 Execution timed out 3005 ms 6904 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 16 ms 768 KB Output is correct
20 Correct 16 ms 768 KB Output is correct
21 Correct 17 ms 640 KB Output is correct
22 Correct 125 ms 700 KB Output is correct
23 Correct 127 ms 732 KB Output is correct
24 Correct 131 ms 640 KB Output is correct
25 Correct 138 ms 640 KB Output is correct
26 Correct 141 ms 640 KB Output is correct
27 Correct 1038 ms 17452 KB Output is correct
28 Correct 826 ms 17328 KB Output is correct
29 Correct 787 ms 17052 KB Output is correct
30 Correct 824 ms 17388 KB Output is correct
31 Execution timed out 3098 ms 15224 KB Time limit exceeded
32 Halted 0 ms 0 KB -