Submission #405113

# Submission time Handle Problem Language Result Execution time Memory
405113 2021-05-15T17:54:12 Z BERNARB01 Circle selection (APIO18_circle_selection) C++17
0 / 100
831 ms 23460 KB
#include <bits/stdc++.h>

using namespace std;

long double dist(int x, int y, int xx, int yy) {
	return sqrtl((x - xx) * (x - xx) + (y - yy) * (y - yy));
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> x(n), y(n), r(n);
	set<pair<int, int>> ms;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> r[i];
		ms.insert({-r[i], i});
	}
	vector<int> a(n, -1);
	while (!ms.empty()) {
		int jj = ms.begin()->second;
		a[jj] = jj;
		ms.erase(ms.begin());
		for (int i = 0; i < n; i++) {
			if (a[i] == -1) {
				if (dist(x[i], y[i], x[jj], y[jj]) <= (long double) r[i] + r[jj]) {
					a[i] = jj;
					ms.erase({-r[i], i});
				}
			}
		}
	}
	for (const auto& xx : a) {
		cout << xx + 1 << " ";
	}
	cout << '\n';
	return 0;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 553 ms 23460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 831 ms 22556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -