이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5e3 + 10;
bool done[N];
int n, ans[N], x[N], y[N], r[N];
int solveTestCase() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> x[i] >> y[i] >> r[i];
for (int i = 0; i < n; i++) {
pair<int, int> best = {1e18, 1e18};
for (int j = 0; j < n; j++) {
if (!done[j])
best = min(best, {-r[j], j});
}
if (best.first == 1e18)
break;
for (int j = 0,ind = best.second; j < n; j++) {
if (done[j])
continue;
int dist = (x[ind] - x[j]) * (x[ind] - x[j]) + (y[ind] - y[j]) * (y[ind] - y[j]);
if (dist <= (r[ind] + r[j]) * (r[ind] + r[j]))
ans[j] = ind + 1, done[j] = true;;
}
}
for (int i = 0; i < n; i++)
cout << ans[i] << " ";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
//cin >> t;
while (t--)
solveTestCase();
}
컴파일 시 표준 에러 (stderr) 메시지
circle_selection.cpp: In function 'long long int solveTestCase()':
circle_selection.cpp:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
34 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |