Submission #49316

# Submission time Handle Problem Language Result Execution time Memory
49316 2018-05-25T15:54:35 Z WLZ Circle selection (APIO18_circle_selection) C++17
0 / 100
3000 ms 14552 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, pair<int, pair<int, int>>> circle;


int n;
bool* used;
vector<circle> v;
vector<int> ans;

int main() {
	scanf("%d", &n);
	used = new bool[n];
	memset(used, 0, sizeof (bool) * n);
	priority_queue<circle> pq;
	ans.resize(n);
	for (int i = 0; i < n; i++) {
		int x, y, r;
		scanf("%d %d %d", &x, &y, &r);
		pq.push({r, {-i, {x, y}}});
		v.push_back({r, {-i, {x, y}}});
	}
	while (!pq.empty()) {
		circle cur = pq.top(); pq.pop();
		int x = cur.second.second.first;
		int y = cur.second.second.second;
		if (used[-cur.second.first]) continue;
		used[-cur.second.first] = true;
		ans[-cur.second.first] = -cur.second.first;
		for (int i = 0; i < n; i++) {
			if (hypot(v[i].second.second.first - x, v[i].second.second.second - y) <= double(cur.first + v[i].first)) {
				used[i] = true;
				ans[i] = -cur.second.first;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (i) printf(" ");
		printf("%d", ans[i] + 1);
	}
	printf("\n");
	return 0;
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
circle_selection.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &x, &y, &r);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 3 ms 484 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Incorrect 2 ms 516 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 295 ms 14456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14456 KB Output is correct
2 Execution timed out 3004 ms 14456 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3026 ms 14552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 3 ms 484 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Incorrect 2 ms 516 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 3 ms 484 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Incorrect 2 ms 516 KB Output isn't correct
9 Halted 0 ms 0 KB -