| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 106507 | bert30702 | 원 고르기 (APIO18_circle_selection) | C++17 | 3025 ms | 21224 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef complex<long double> C;
const int MX = 3e5 + 100;
const double EPS = 1e-5;
struct circle { C p; int r, i; } v[MX];
int ans[MX];
bool touch(int a, int b) {
return !ans[b] and abs(v[b].p - v[a].p) <= v[a].r + v[b].r;
}
main () {
srand(time(0));
int n; cin >> n;
for(int i = 1; i <= n; i ++) {
int x, y, r; cin >> x >> y >> r;
v[i] = {{x, y}, r, i};
}
double ang = rand() * 0.0001;
for(int i = 1; i <= n; i ++) v[i].p *= C{cos(ang), sin(ang)};
sort(v + 1, v + 1 + n, [](circle a, circle b) { return a.p.X < b.p.X; });
priority_queue<pair<int, pii> > pq;
for(int i = 1; i <= n; i ++) pq.push({v[i].r, {-v[i].i, -i}});
while(pq.size()) {
int p = -pq.top().S.S; pq.pop();
if(ans[v[p].i]) continue;
for(int i = max(1, p - 5000); i <= min(n, p + 5000); i ++) {
if(!ans[v[i].i] and abs(v[p].p - v[i].p) - EPS <= v[p].r + v[i].r) ans[v[i].i] = v[p].i;
}
}
for(int i = 1; i <= n; i ++) cout << ans[i] << ' ';
}컴파일 시 표준 에러 (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... | ||||
