답안 #728296

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
728296 2023-04-22T07:01:37 Z SanguineChameleon 원 고르기 (APIO18_circle_selection) C++17
7 / 100
139 ms 1368 KB
#include <bits/stdc++.h>
using namespace std;

void just_do_it();

int main() {
	#ifdef KAMIRULEZ
		freopen("kamirulez.inp", "r", stdin);
		freopen("kamirulez.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	just_do_it();
	return 0;
}

struct circle {
	int x, y, r;
};

bool intersect(circle C1, circle C2) {
	return 1LL * (C1.r + C2.r) * (C1.r + C2.r) >= 1LL * (C1.x - C2.x) * (C1.x - C2.x) + 1LL * (C1.y - C2.y) * (C1.y - C2.y); 
}

const int maxn = 5e3 + 20;
circle C[maxn];
int res[maxn];
set<pair<int, int>> S;

void just_do_it() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> C[i].x >> C[i].y >> C[i].r;
		S.insert({-C[i].r, i});
	}
	while (!S.empty()) {
		int cur = S.begin()->second;
		auto it = S.begin();
		while (it != S.end()) {
			int nxt = it->second;
			if (intersect(C[cur], C[nxt])) {
				res[nxt] = cur;
				it = S.erase(it);
			}
			else {
				it++;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << res[i] << " ";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 716 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 4 ms 724 KB Output is correct
22 Correct 139 ms 752 KB Output is correct
23 Correct 135 ms 724 KB Output is correct
24 Correct 136 ms 764 KB Output is correct
25 Correct 134 ms 752 KB Output is correct
26 Correct 136 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1364 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 5 ms 1364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 716 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 4 ms 724 KB Output is correct
22 Correct 139 ms 752 KB Output is correct
23 Correct 135 ms 724 KB Output is correct
24 Correct 136 ms 764 KB Output is correct
25 Correct 134 ms 752 KB Output is correct
26 Correct 136 ms 748 KB Output is correct
27 Runtime error 4 ms 1316 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 328 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 716 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 4 ms 724 KB Output is correct
22 Correct 139 ms 752 KB Output is correct
23 Correct 135 ms 724 KB Output is correct
24 Correct 136 ms 764 KB Output is correct
25 Correct 134 ms 752 KB Output is correct
26 Correct 136 ms 748 KB Output is correct
27 Runtime error 4 ms 1364 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -