답안 #1111665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1111665 2024-11-12T14:04:49 Z Onur_Ilgaz 원 고르기 (APIO18_circle_selection) C++17
7 / 100
3000 ms 30448 KB
#include <bits/stdc++.h>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
using namespace std;

void brute(int n, vector <array<int, 4>> arr) {
	sort(arr.begin() + 1, arr.end(), [](array<int, 4> a, array<int, 4> b) {
		return a[0] == b[0] ? (a[3] < b[3]) : a[0] > b[0];
	});
	vector <int> p(n + 1);
	auto inside = [&](int x1, int y1, int x2, int y2, int have) {
		return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) <= have * have;
	};
	for(int i = 1; i <= n; i++) {
		auto [r, x, y, ans_ind] = arr[i];
		if(p[ans_ind]) continue;
		p[ans_ind] = ans_ind;
		for(int j = 1; j <= n; j++) {
			auto [tr, tx, ty, tans_ind] = arr[j];
			if(p[tans_ind] or !inside(x, y, tx, ty, r + tr)) continue;
			p[tans_ind] = ans_ind;
		}
	}
	for(int i = 1; i <= n; i++) {
		cout << p[i] << ' ';
	}
}

int32_t main(){
	fast
	int n;
	cin >> n;
	vector <array<int, 4> > arr(n + 1);
	for(int i = 1; i <= n; i++) {
		cin >> arr[i][1] >> arr[i][2] >> arr[i][0];
		arr[i][3] = i;
	}
	brute(n, arr);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 524 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 2 ms 508 KB Output is correct
19 Correct 3 ms 768 KB Output is correct
20 Correct 3 ms 848 KB Output is correct
21 Correct 3 ms 848 KB Output is correct
22 Correct 34 ms 848 KB Output is correct
23 Correct 32 ms 848 KB Output is correct
24 Correct 33 ms 948 KB Output is correct
25 Correct 33 ms 848 KB Output is correct
26 Correct 33 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 30280 KB Output is correct
2 Correct 121 ms 30288 KB Output is correct
3 Correct 118 ms 30024 KB Output is correct
4 Correct 128 ms 30448 KB Output is correct
5 Execution timed out 3062 ms 26184 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Execution timed out 3084 ms 10064 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3055 ms 29256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 524 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 2 ms 508 KB Output is correct
19 Correct 3 ms 768 KB Output is correct
20 Correct 3 ms 848 KB Output is correct
21 Correct 3 ms 848 KB Output is correct
22 Correct 34 ms 848 KB Output is correct
23 Correct 32 ms 848 KB Output is correct
24 Correct 33 ms 948 KB Output is correct
25 Correct 33 ms 848 KB Output is correct
26 Correct 33 ms 848 KB Output is correct
27 Correct 5 ms 1360 KB Output is correct
28 Correct 7 ms 1360 KB Output is correct
29 Correct 5 ms 1360 KB Output is correct
30 Correct 130 ms 1360 KB Output is correct
31 Correct 146 ms 1420 KB Output is correct
32 Correct 138 ms 1440 KB Output is correct
33 Correct 38 ms 11004 KB Output is correct
34 Correct 38 ms 11096 KB Output is correct
35 Correct 53 ms 10968 KB Output is correct
36 Execution timed out 3049 ms 9812 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 524 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 2 ms 508 KB Output is correct
19 Correct 3 ms 768 KB Output is correct
20 Correct 3 ms 848 KB Output is correct
21 Correct 3 ms 848 KB Output is correct
22 Correct 34 ms 848 KB Output is correct
23 Correct 32 ms 848 KB Output is correct
24 Correct 33 ms 948 KB Output is correct
25 Correct 33 ms 848 KB Output is correct
26 Correct 33 ms 848 KB Output is correct
27 Correct 128 ms 30280 KB Output is correct
28 Correct 121 ms 30288 KB Output is correct
29 Correct 118 ms 30024 KB Output is correct
30 Correct 128 ms 30448 KB Output is correct
31 Execution timed out 3062 ms 26184 KB Time limit exceeded
32 Halted 0 ms 0 KB -