답안 #405408

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405408 2021-05-16T11:09:23 Z saleh 원 고르기 (APIO18_circle_selection) C++17
7 / 100
264 ms 756 KB
#include <bits/stdc++.h>


using namespace std;


const int MAXN = 5000 + 3;



/*
11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1
*/











int n, x[MAXN], y[MAXN], r[MAXN], par[MAXN];

struct cmp { bool operator ()(int a, int b) const { return r[a] > r[b]? true: (r[a] == r[b]? a < b: false); } };
set<int, cmp> s;

auto dis(int a, int b) { return sqrt(1ll * abs(x[a] - x[b]) * abs(x[a] - x[b]) + 1ll * abs(y[a] - y[b]) * abs(y[a] - y[b])); }
bool sect(int a, int b) { return dis(a, b) <= r[a] + r[b]; }


int main() {
	cin >> n;
	if (n >= MAXN) return 0;
	for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i];
	for (int i = 0; i < n; i++) s.insert(i);
	while (!s.empty()) {
		int x = *s.begin();
		for (auto i = s.begin(); i != s.end(); ) if (sect(*i, x)) {
			par[*i] = x;
			i = s.erase(i);
		} else i++;
	}
	for (int i = 0; i < n; i++) cout << par[i] + 1 << ' ';
	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 300 KB Output is correct
5 Correct 1 ms 204 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 292 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 3 ms 428 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 3 ms 332 KB Output is correct
19 Correct 11 ms 740 KB Output is correct
20 Correct 10 ms 756 KB Output is correct
21 Correct 12 ms 716 KB Output is correct
22 Correct 241 ms 716 KB Output is correct
23 Correct 241 ms 712 KB Output is correct
24 Correct 242 ms 720 KB Output is correct
25 Correct 246 ms 716 KB Output is correct
26 Correct 264 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
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 300 KB Output is correct
5 Correct 1 ms 204 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 292 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 3 ms 428 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 3 ms 332 KB Output is correct
19 Correct 11 ms 740 KB Output is correct
20 Correct 10 ms 756 KB Output is correct
21 Correct 12 ms 716 KB Output is correct
22 Correct 241 ms 716 KB Output is correct
23 Correct 241 ms 712 KB Output is correct
24 Correct 242 ms 720 KB Output is correct
25 Correct 246 ms 716 KB Output is correct
26 Correct 264 ms 716 KB Output is correct
27 Incorrect 1 ms 204 KB Output isn't correct
28 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 300 KB Output is correct
5 Correct 1 ms 204 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 292 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 3 ms 428 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 3 ms 332 KB Output is correct
19 Correct 11 ms 740 KB Output is correct
20 Correct 10 ms 756 KB Output is correct
21 Correct 12 ms 716 KB Output is correct
22 Correct 241 ms 716 KB Output is correct
23 Correct 241 ms 712 KB Output is correct
24 Correct 242 ms 720 KB Output is correct
25 Correct 246 ms 716 KB Output is correct
26 Correct 264 ms 716 KB Output is correct
27 Incorrect 1 ms 204 KB Output isn't correct
28 Halted 0 ms 0 KB -