# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
99820 | 2019-03-07T16:18:49 Z | TadijaSebez | 원 고르기 (APIO18_circle_selection) | C++11 | 3000 ms | 180092 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back struct circle{ ll x,y,r;int id;circle(){}circle(ll a, ll b, ll c):x(a),y(b),r(c){}}; ll sq(ll x){ return x*x;} bool sec(circle a, circle b){ return sq(a.x-b.x)+sq(a.y-b.y)<=sq(a.r+b.r);} const int N=300050; circle a[N]; int ans[N]; map<pair<int,int>,vector<circle>> all; int main() { int n,i; scanf("%i",&n); for(i=1;i<=n;i++) scanf("%lld %lld %lld",&a[i].x,&a[i].y,&a[i].r),a[i].id=i; sort(a+1,a+1+n,[](circle a, circle b){ return a.r>b.r || a.r==b.r && a.id<b.id;}); for(int j=30;j>=0;j--) { int po=1<<j; all.clear(); for(i=1;i<=n;i++) if(!ans[a[i].id]) { all[mp(floor((double)a[i].x/po),floor((double)a[i].y/po))].pb(a[i]); } for(i=1;i<=n;i++) if(!ans[a[i].id] && a[i].r>=(1<<j-1)) { int x=floor((double)a[i].x/po); int y=floor((double)a[i].y/po); for(int l=-2;l<=2;l++) for(int r=-2;r<=2;r++) { vector<circle> v=all[mp(x+l,y+r)],e; for(circle c:v) { if(sec(c,a[i])) ans[c.id]=a[i].id; else e.pb(c); } all[mp(x+l,y+r)]=e; } } } for(i=1;i<=n;i++) printf("%i%c",ans[i],i==n?'\n':' '); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 6 ms | 1024 KB | Output is correct |
20 | Correct | 6 ms | 1148 KB | Output is correct |
21 | Correct | 7 ms | 1024 KB | Output is correct |
22 | Correct | 76 ms | 5192 KB | Output is correct |
23 | Correct | 80 ms | 5468 KB | Output is correct |
24 | Correct | 69 ms | 4296 KB | Output is correct |
25 | Correct | 73 ms | 4960 KB | Output is correct |
26 | Correct | 73 ms | 5276 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 382 ms | 30076 KB | Output is correct |
2 | Correct | 411 ms | 33980 KB | Output is correct |
3 | Correct | 413 ms | 32888 KB | Output is correct |
4 | Correct | 338 ms | 31324 KB | Output is correct |
5 | Correct | 1010 ms | 36012 KB | Output is correct |
6 | Execution timed out | 3024 ms | 73932 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2812 ms | 90804 KB | Output is correct |
3 | Execution timed out | 3027 ms | 48352 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3099 ms | 48320 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 6 ms | 1024 KB | Output is correct |
20 | Correct | 6 ms | 1148 KB | Output is correct |
21 | Correct | 7 ms | 1024 KB | Output is correct |
22 | Correct | 76 ms | 5192 KB | Output is correct |
23 | Correct | 80 ms | 5468 KB | Output is correct |
24 | Correct | 69 ms | 4296 KB | Output is correct |
25 | Correct | 73 ms | 4960 KB | Output is correct |
26 | Correct | 73 ms | 5276 KB | Output is correct |
27 | Correct | 16 ms | 1740 KB | Output is correct |
28 | Correct | 12 ms | 1792 KB | Output is correct |
29 | Correct | 10 ms | 1724 KB | Output is correct |
30 | Correct | 167 ms | 11228 KB | Output is correct |
31 | Correct | 168 ms | 11128 KB | Output is correct |
32 | Correct | 189 ms | 8612 KB | Output is correct |
33 | Correct | 93 ms | 10468 KB | Output is correct |
34 | Correct | 106 ms | 10596 KB | Output is correct |
35 | Correct | 166 ms | 10528 KB | Output is correct |
36 | Correct | 2992 ms | 98660 KB | Output is correct |
37 | Correct | 2935 ms | 86860 KB | Output is correct |
38 | Correct | 2968 ms | 99940 KB | Output is correct |
39 | Correct | 979 ms | 15760 KB | Output is correct |
40 | Correct | 1004 ms | 15524 KB | Output is correct |
41 | Correct | 1085 ms | 15560 KB | Output is correct |
42 | Correct | 576 ms | 13760 KB | Output is correct |
43 | Correct | 2547 ms | 179632 KB | Output is correct |
44 | Correct | 2409 ms | 179828 KB | Output is correct |
45 | Correct | 2442 ms | 179616 KB | Output is correct |
46 | Correct | 2410 ms | 179976 KB | Output is correct |
47 | Correct | 2404 ms | 180092 KB | Output is correct |
48 | Correct | 2497 ms | 179784 KB | Output is correct |
49 | Correct | 2323 ms | 180084 KB | Output is correct |
50 | Correct | 2441 ms | 179824 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 4 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 6 ms | 1024 KB | Output is correct |
20 | Correct | 6 ms | 1148 KB | Output is correct |
21 | Correct | 7 ms | 1024 KB | Output is correct |
22 | Correct | 76 ms | 5192 KB | Output is correct |
23 | Correct | 80 ms | 5468 KB | Output is correct |
24 | Correct | 69 ms | 4296 KB | Output is correct |
25 | Correct | 73 ms | 4960 KB | Output is correct |
26 | Correct | 73 ms | 5276 KB | Output is correct |
27 | Correct | 382 ms | 30076 KB | Output is correct |
28 | Correct | 411 ms | 33980 KB | Output is correct |
29 | Correct | 413 ms | 32888 KB | Output is correct |
30 | Correct | 338 ms | 31324 KB | Output is correct |
31 | Correct | 1010 ms | 36012 KB | Output is correct |
32 | Execution timed out | 3024 ms | 73932 KB | Time limit exceeded |
33 | Halted | 0 ms | 0 KB | - |