답안 #983049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983049 2024-05-15T07:23:46 Z vjudge1 원 고르기 (APIO18_circle_selection) C++17
7 / 100
3000 ms 52912 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, i, j, k, x[300001], y[300001], r[300001], ans[300001];
bool u[300001];
multiset<pair<int, int>> ms, mss;

long double dist(long double x1, long double y1, long double x2, long double y2) {
	return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}

bool inter(int i, int j) {
	return r[i] + r[j] >= dist(x[i], y[i], x[j], y[j]);
}

signed main() {
	cin.tie(0)->sync_with_stdio(0);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	#endif
	cin >> n;
	bool subtask2 = 1;
	for (i = 1; i <= n; i++) {
		cin >> x[i] >> y[i] >> r[i];
		ms.insert({r[i], -i});
		//y[i] = 0;
		if (y[i] != 0) {
			subtask2 = 0;
		}
	}
	for (i = 1; i <= n; i++) {
		if (ms.empty()) break;
		k = -(*ms.rbegin()).second;
		ms.erase(prev(ms.end()));
		ans[k] = k;
		for (auto j : ms) {
			if (inter(k, -j.second)) {
				ans[-j.second] = k;
			}
			else mss.insert(j);
		}
		ms = mss;
		mss.clear();
	} //
	for (i = 1; i <= n; i++) cout << ans[i] << " ";
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:22:7: warning: variable 'subtask2' set but not used [-Wunused-but-set-variable]
   22 |  bool subtask2 = 1;
      |       ^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 3 ms 1116 KB Output is correct
20 Correct 3 ms 1116 KB Output is correct
21 Correct 3 ms 1116 KB Output is correct
22 Correct 1074 ms 1644 KB Output is correct
23 Correct 1103 ms 1392 KB Output is correct
24 Correct 1086 ms 1392 KB Output is correct
25 Correct 1168 ms 1380 KB Output is correct
26 Correct 1074 ms 1616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 273 ms 37720 KB Output is correct
2 Correct 386 ms 46932 KB Output is correct
3 Correct 295 ms 40008 KB Output is correct
4 Correct 274 ms 37656 KB Output is correct
5 Execution timed out 3018 ms 51900 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 3055 ms 18540 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3045 ms 52912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 3 ms 1116 KB Output is correct
20 Correct 3 ms 1116 KB Output is correct
21 Correct 3 ms 1116 KB Output is correct
22 Correct 1074 ms 1644 KB Output is correct
23 Correct 1103 ms 1392 KB Output is correct
24 Correct 1086 ms 1392 KB Output is correct
25 Correct 1168 ms 1380 KB Output is correct
26 Correct 1074 ms 1616 KB Output is correct
27 Correct 5 ms 1628 KB Output is correct
28 Correct 5 ms 1696 KB Output is correct
29 Correct 5 ms 1628 KB Output is correct
30 Execution timed out 3047 ms 2304 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 3 ms 1116 KB Output is correct
20 Correct 3 ms 1116 KB Output is correct
21 Correct 3 ms 1116 KB Output is correct
22 Correct 1074 ms 1644 KB Output is correct
23 Correct 1103 ms 1392 KB Output is correct
24 Correct 1086 ms 1392 KB Output is correct
25 Correct 1168 ms 1380 KB Output is correct
26 Correct 1074 ms 1616 KB Output is correct
27 Correct 273 ms 37720 KB Output is correct
28 Correct 386 ms 46932 KB Output is correct
29 Correct 295 ms 40008 KB Output is correct
30 Correct 274 ms 37656 KB Output is correct
31 Execution timed out 3018 ms 51900 KB Time limit exceeded
32 Halted 0 ms 0 KB -