Submission #743397

# Submission time Handle Problem Language Result Execution time Memory
743397 2023-05-17T11:14:22 Z alvingogo Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 25020 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
#define int long long
using namespace std;

typedef pair<int,int> pii;
pii operator+(pii a,pii b){
    return {a.fs+b.fs,a.sc+b.sc};
}
pii operator-(pii a,pii b){
    return {a.fs-b.fs,a.sc-b.sc};
}
int dot(pii a,pii b){
    return a.fs*b.fs+a.sc*b.sc;
}
int cross(pii a,pii b){
    return a.fs*b.sc-b.fs*a.sc;
}
int dis(pii a,pii b){
    return dot(a-b,a-b);
}
signed main(){
    AquA;
    int n;
    cin >> n;
    vector<pair<pii,int> > vp(n);
    vector<pii> g;
    vector<int> from(n,-1);
    for(int i=0;i<n;i++){
        cin >> vp[i].fs.fs >> vp[i].fs.sc >> vp[i].sc;
        g.push_back({-vp[i].sc,i});
    }
    sort(g.begin(),g.end());
    for(int k=0;k<n;k++){
        int i=g[k].sc;
        if(from[i]==-1){
            for(int j=0;j<n;j++){
                if(from[j]==-1){
                    if(dis(vp[i].fs,vp[j].fs)<=(vp[i].sc+vp[j].sc)*(vp[i].sc+vp[j].sc)){
                        from[j]=i;
                    }
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << from[i]+1 << " ";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 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 316 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 320 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 844 KB Output is correct
20 Correct 3 ms 852 KB Output is correct
21 Correct 3 ms 840 KB Output is correct
22 Correct 48 ms 808 KB Output is correct
23 Correct 47 ms 804 KB Output is correct
24 Correct 47 ms 808 KB Output is correct
25 Correct 55 ms 796 KB Output is correct
26 Correct 49 ms 796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 139 ms 24180 KB Output is correct
2 Correct 151 ms 24076 KB Output is correct
3 Correct 139 ms 24104 KB Output is correct
4 Correct 134 ms 24148 KB Output is correct
5 Execution timed out 3062 ms 22248 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 3050 ms 7872 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3051 ms 25020 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 1 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 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 316 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 320 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 844 KB Output is correct
20 Correct 3 ms 852 KB Output is correct
21 Correct 3 ms 840 KB Output is correct
22 Correct 48 ms 808 KB Output is correct
23 Correct 47 ms 804 KB Output is correct
24 Correct 47 ms 808 KB Output is correct
25 Correct 55 ms 796 KB Output is correct
26 Correct 49 ms 796 KB Output is correct
27 Correct 6 ms 1236 KB Output is correct
28 Correct 6 ms 1236 KB Output is correct
29 Correct 5 ms 1320 KB Output is correct
30 Correct 211 ms 1236 KB Output is correct
31 Correct 223 ms 1236 KB Output is correct
32 Correct 221 ms 1308 KB Output is correct
33 Correct 48 ms 8776 KB Output is correct
34 Correct 46 ms 8752 KB Output is correct
35 Correct 51 ms 8772 KB Output is correct
36 Execution timed out 3054 ms 7632 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 1 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 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 316 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 320 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 844 KB Output is correct
20 Correct 3 ms 852 KB Output is correct
21 Correct 3 ms 840 KB Output is correct
22 Correct 48 ms 808 KB Output is correct
23 Correct 47 ms 804 KB Output is correct
24 Correct 47 ms 808 KB Output is correct
25 Correct 55 ms 796 KB Output is correct
26 Correct 49 ms 796 KB Output is correct
27 Correct 139 ms 24180 KB Output is correct
28 Correct 151 ms 24076 KB Output is correct
29 Correct 139 ms 24104 KB Output is correct
30 Correct 134 ms 24148 KB Output is correct
31 Execution timed out 3062 ms 22248 KB Time limit exceeded
32 Halted 0 ms 0 KB -