답안 #982989

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982989 2024-05-15T06:31:06 Z vjudge1 원 고르기 (APIO18_circle_selection) C++17
7 / 100
3000 ms 52220 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 1 ms 2396 KB Output is correct
2 Correct 0 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 1 ms 2552 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 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 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 1061 ms 1360 KB Output is correct
23 Correct 1181 ms 1268 KB Output is correct
24 Correct 1066 ms 1256 KB Output is correct
25 Correct 1090 ms 1256 KB Output is correct
26 Correct 1073 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 30844 KB Output is correct
2 Correct 341 ms 46768 KB Output is correct
3 Correct 284 ms 39992 KB Output is correct
4 Correct 270 ms 37584 KB Output is correct
5 Execution timed out 3096 ms 52220 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Execution timed out 3042 ms 15924 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3047 ms 44856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 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 1 ms 2552 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 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 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 1061 ms 1360 KB Output is correct
23 Correct 1181 ms 1268 KB Output is correct
24 Correct 1066 ms 1256 KB Output is correct
25 Correct 1090 ms 1256 KB Output is correct
26 Correct 1073 ms 1360 KB Output is correct
27 Correct 6 ms 3416 KB Output is correct
28 Correct 5 ms 1372 KB Output is correct
29 Correct 5 ms 1448 KB Output is correct
30 Execution timed out 3024 ms 2032 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 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 1 ms 2552 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 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 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 608 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 860 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 1061 ms 1360 KB Output is correct
23 Correct 1181 ms 1268 KB Output is correct
24 Correct 1066 ms 1256 KB Output is correct
25 Correct 1090 ms 1256 KB Output is correct
26 Correct 1073 ms 1360 KB Output is correct
27 Correct 289 ms 30844 KB Output is correct
28 Correct 341 ms 46768 KB Output is correct
29 Correct 284 ms 39992 KB Output is correct
30 Correct 270 ms 37584 KB Output is correct
31 Execution timed out 3096 ms 52220 KB Time limit exceeded
32 Halted 0 ms 0 KB -