# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
439936 | 2021-07-01T08:49:48 Z | VladM | 원 고르기 (APIO18_circle_selection) | C++14 | 265 ms | 216932 KB |
#include <bits/stdc++.h> using namespace std; #define DIM 5007 struct circle { long long R, it; }; long long n, x[DIM], y[DIM], r[DIM], R, it, vis[DIM], par[DIM]; vector<long long> vec[DIM]; vector<circle> c; bool cmp(circle a, circle b) { if(a.R==b.R) return a.it>b.it; return a.R<b.R; } int main() { scanf("%lld", &n); for(int i=1; i<=n; i++) { scanf("%lld%lld%lld", &x[i], &y[i], &r[i]); } for(int i=1; i<=n; i++) { c.push_back({r[i], i}); for(int j=1; j<=n; j++) { if((r[i]+r[j])*(r[i]+r[j])>=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])) { vec[i].push_back(j); } } } sort(c.begin(), c.end(), cmp); reverse(c.begin(), c.end()); for(int i=0; i<n; i++) { R=c[i].R; it=c[i].it; if(vis[it]!=0) continue; vis[it]=1; par[it]=it; for(auto v : vec[it]) { if(vis[v]!=0) continue; vis[v]=1; par[v]=it; } } for(int i=1; i<=n; i++) printf("%lld ", par[i]); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 456 KB | Output is correct |
7 | Correct | 2 ms | 460 KB | Output is correct |
8 | Correct | 2 ms | 460 KB | Output is correct |
9 | Correct | 1 ms | 460 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 12 ms | 7884 KB | Output is correct |
17 | Correct | 12 ms | 7488 KB | Output is correct |
18 | Correct | 15 ms | 8524 KB | Output is correct |
19 | Correct | 241 ms | 211524 KB | Output is correct |
20 | Correct | 225 ms | 216932 KB | Output is correct |
21 | Correct | 265 ms | 137872 KB | Output is correct |
22 | Correct | 43 ms | 924 KB | Output is correct |
23 | Correct | 43 ms | 964 KB | Output is correct |
24 | Correct | 45 ms | 1000 KB | Output is correct |
25 | Correct | 44 ms | 984 KB | Output is correct |
26 | Correct | 46 ms | 916 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 844 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Incorrect | 3 ms | 812 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 456 KB | Output is correct |
7 | Correct | 2 ms | 460 KB | Output is correct |
8 | Correct | 2 ms | 460 KB | Output is correct |
9 | Correct | 1 ms | 460 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 12 ms | 7884 KB | Output is correct |
17 | Correct | 12 ms | 7488 KB | Output is correct |
18 | Correct | 15 ms | 8524 KB | Output is correct |
19 | Correct | 241 ms | 211524 KB | Output is correct |
20 | Correct | 225 ms | 216932 KB | Output is correct |
21 | Correct | 265 ms | 137872 KB | Output is correct |
22 | Correct | 43 ms | 924 KB | Output is correct |
23 | Correct | 43 ms | 964 KB | Output is correct |
24 | Correct | 45 ms | 1000 KB | Output is correct |
25 | Correct | 44 ms | 984 KB | Output is correct |
26 | Correct | 46 ms | 916 KB | Output is correct |
27 | Runtime error | 5 ms | 1112 KB | Execution killed with signal 11 |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 456 KB | Output is correct |
7 | Correct | 2 ms | 460 KB | Output is correct |
8 | Correct | 2 ms | 460 KB | Output is correct |
9 | Correct | 1 ms | 460 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 1 ms | 332 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 12 ms | 7884 KB | Output is correct |
17 | Correct | 12 ms | 7488 KB | Output is correct |
18 | Correct | 15 ms | 8524 KB | Output is correct |
19 | Correct | 241 ms | 211524 KB | Output is correct |
20 | Correct | 225 ms | 216932 KB | Output is correct |
21 | Correct | 265 ms | 137872 KB | Output is correct |
22 | Correct | 43 ms | 924 KB | Output is correct |
23 | Correct | 43 ms | 964 KB | Output is correct |
24 | Correct | 45 ms | 1000 KB | Output is correct |
25 | Correct | 44 ms | 984 KB | Output is correct |
26 | Correct | 46 ms | 916 KB | Output is correct |
27 | Incorrect | 3 ms | 844 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |