Submission #747777

# Submission time Handle Problem Language Result Execution time Memory
747777 2023-05-24T16:59:38 Z 1075508020060209tc Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 18516 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define X first
#define Y second
int n;
pair<int,int>pts[300005];
int rr[300005];
int ans[300005];

int dis(int a,int b){
int ret=(pts[a].first-pts[b].first)*(pts[a].first-pts[b].first)+(pts[a].second-pts[b].second)*(pts[a].second-pts[b].second);
return ret;
}


signed main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>pts[i].X>>pts[i].Y>>rr[i];
    }

    while(1){
        int mx=0;
        for(int i=1;i<=n;i++){
            if(ans[i]){continue;}
            mx=max(mx,rr[i]);
        }
        if(mx==0){break;}
        int nw=0;
        for(int i=1;i<=n;i++){
            if(ans[i]){continue;}
            if(rr[i]==mx){
                nw=i;
                break;
            }
        }
        for(int i=1;i<=n;i++){
            if(ans[i]){continue;}
            if(dis(nw,i)<=(rr[i]+rr[nw])*(rr[i]+rr[nw])){
                ans[i]=nw;
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<" ";
    }


}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 312 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 2 ms 324 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 7 ms 640 KB Output is correct
20 Correct 6 ms 596 KB Output is correct
21 Correct 7 ms 596 KB Output is correct
22 Correct 180 ms 616 KB Output is correct
23 Correct 179 ms 588 KB Output is correct
24 Correct 182 ms 596 KB Output is correct
25 Correct 179 ms 596 KB Output is correct
26 Correct 189 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 318 ms 18448 KB Output is correct
2 Correct 304 ms 18368 KB Output is correct
3 Correct 301 ms 18184 KB Output is correct
4 Correct 331 ms 18516 KB Output is correct
5 Execution timed out 3047 ms 14216 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3040 ms 6300 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3039 ms 15376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 312 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 2 ms 324 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 7 ms 640 KB Output is correct
20 Correct 6 ms 596 KB Output is correct
21 Correct 7 ms 596 KB Output is correct
22 Correct 180 ms 616 KB Output is correct
23 Correct 179 ms 588 KB Output is correct
24 Correct 182 ms 596 KB Output is correct
25 Correct 179 ms 596 KB Output is correct
26 Correct 189 ms 596 KB Output is correct
27 Correct 13 ms 932 KB Output is correct
28 Correct 13 ms 980 KB Output is correct
29 Correct 16 ms 840 KB Output is correct
30 Correct 746 ms 888 KB Output is correct
31 Correct 729 ms 868 KB Output is correct
32 Correct 730 ms 932 KB Output is correct
33 Correct 128 ms 7112 KB Output is correct
34 Correct 123 ms 7064 KB Output is correct
35 Correct 143 ms 6888 KB Output is correct
36 Execution timed out 3062 ms 6052 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 312 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 2 ms 324 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 7 ms 640 KB Output is correct
20 Correct 6 ms 596 KB Output is correct
21 Correct 7 ms 596 KB Output is correct
22 Correct 180 ms 616 KB Output is correct
23 Correct 179 ms 588 KB Output is correct
24 Correct 182 ms 596 KB Output is correct
25 Correct 179 ms 596 KB Output is correct
26 Correct 189 ms 596 KB Output is correct
27 Correct 318 ms 18448 KB Output is correct
28 Correct 304 ms 18368 KB Output is correct
29 Correct 301 ms 18184 KB Output is correct
30 Correct 331 ms 18516 KB Output is correct
31 Execution timed out 3047 ms 14216 KB Time limit exceeded
32 Halted 0 ms 0 KB -