Submission #552425

# Submission time Handle Problem Language Result Execution time Memory
552425 2022-04-23T06:50:44 Z zaneyu Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 19000 KB
/*input
11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1
*/
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma target("avx3")
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
const int maxn=3e5+5;
#define pb push_back
#define lowb(x) x&(-x)
#define ll long long
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define pii pair<ll,ll>
#define f first
#define s second
pair<pii,ll> arr[maxn];
inline bool inter(int a,int b){
    ll d=(arr[a].f.s-arr[b].f.s)*(arr[a].f.s-arr[b].f.s)+(arr[a].f.f-arr[b].f.f)*(arr[a].f.f-arr[b].f.f);
    return d<=(arr[a].s+arr[b].s)*(arr[a].s+arr[b].s);
}
bool ok[maxn];
int ans[maxn];
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin>>n;
    vector<int> v;
    REP(i,n) cin>>arr[i].f.f>>arr[i].f.s>>arr[i].s,v.pb(i);
    REP(i,n){
        int p=-1;
        for(int j:v){
            if(ok[j]) continue;
            if(p==-1 or arr[p].s<arr[j].s) p=j;
        }
        if(p==-1) break;
        vector<int> nv;
        for(int j:v){
            if(inter(j,p)) ans[j]=p,ok[j]=1;
            else nv.pb(j);
        }
        v=nv;
    }
    REP(i,n){
        cout<<ans[i]+1<<' ';
    }
}

Compilation message

circle_selection.cpp:17: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
   17 | #pragma target("avx3")
      |
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 84 ms 556 KB Output is correct
23 Correct 84 ms 540 KB Output is correct
24 Correct 87 ms 536 KB Output is correct
25 Correct 89 ms 536 KB Output is correct
26 Correct 90 ms 536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 16580 KB Output is correct
2 Correct 107 ms 18940 KB Output is correct
3 Correct 109 ms 18864 KB Output is correct
4 Correct 101 ms 19000 KB Output is correct
5 Execution timed out 3038 ms 18040 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 3082 ms 4956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3044 ms 17356 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 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 84 ms 556 KB Output is correct
23 Correct 84 ms 540 KB Output is correct
24 Correct 87 ms 536 KB Output is correct
25 Correct 89 ms 536 KB Output is correct
26 Correct 90 ms 536 KB Output is correct
27 Correct 6 ms 724 KB Output is correct
28 Correct 4 ms 724 KB Output is correct
29 Correct 4 ms 660 KB Output is correct
30 Correct 344 ms 752 KB Output is correct
31 Correct 341 ms 764 KB Output is correct
32 Correct 337 ms 760 KB Output is correct
33 Correct 36 ms 4216 KB Output is correct
34 Correct 38 ms 4220 KB Output is correct
35 Correct 36 ms 4196 KB Output is correct
36 Execution timed out 3074 ms 4732 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 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 84 ms 556 KB Output is correct
23 Correct 84 ms 540 KB Output is correct
24 Correct 87 ms 536 KB Output is correct
25 Correct 89 ms 536 KB Output is correct
26 Correct 90 ms 536 KB Output is correct
27 Correct 106 ms 16580 KB Output is correct
28 Correct 107 ms 18940 KB Output is correct
29 Correct 109 ms 18864 KB Output is correct
30 Correct 101 ms 19000 KB Output is correct
31 Execution timed out 3038 ms 18040 KB Time limit exceeded
32 Halted 0 ms 0 KB -