# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
797394 | radaiosm7 | 원 고르기 (APIO18_circle_selection) | C++98 | 3085 ms | 19632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
int n, i, j, curr, chk;
long long R1, R2;
int ans[300005];
pair<long long, int> rd[300005];
pair<long long, long long> pnt[300005];
bool cmp(const pair<long long, int>& a, const pair<long long, int>& b) {
if (a.X == b.X) return a.Y < b.Y;
else return a.X > b.X;
}
bool val(int x, int y) {
return (pnt[x].X-pnt[y].X)*(pnt[x].X-pnt[y].X) + (pnt[x].Y-pnt[y].Y)*(pnt[x].Y-pnt[y].Y) <= (R1+R2)*(R1+R2);
}
int main() {
scanf("%d", &n);
for (i=1; i <= n; ++i) {
scanf("%lld%lld%lld", &pnt[i].X, &pnt[i].Y, &rd[i].X);
rd[i].Y = i;
}
sort(rd+1, rd+n+1, cmp);
fill(ans, ans+n+1, -1);
for (i=1; i <= n; ++i) {
curr = rd[i].Y;
R1 = rd[i].X;
if (ans[curr] == -1) {
ans[curr] = curr;
for (j=i+1; j <= n; ++j) {
chk = rd[j].Y;
R2 = rd[j].X;
if (ans[chk] == -1 && val(curr, chk)) ans[chk] = curr;
}
}
}
for (i=1; i < n; ++i) printf("%d ", ans[i]);
printf("%d\n", ans[n]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |