Submission #698703

# Submission time Handle Problem Language Result Execution time Memory
698703 2023-02-14T08:23:18 Z vjudge1 Circle selection (APIO18_circle_selection) C++17
7 / 100
3000 ms 11988 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl "\n"
int mod=1e9+7;
const int N=1e5+5;
template<class x>
using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(".in", "r", stdin); freopen(".out", "w", stdout);

    int n; cin>>n;
    pair<int,pair<pair<int,int >,int> > v[n];
    for (int i=0;i<n;i++) {
      cin>>v[i].second.first.first>>v[i].second.first.second>>v[i].first;
      v[i].first*=-1; v[i].second.second=i;
    }
    sort(v,v+n);

    int ans[n];
    for (int i=0;i<n;i++) ans[i]=-1;

    for (int i=0;i<n;i++) {
      for (int j=i+1;j<n;j++) {
        int indx1=v[i].second.second,indx2=v[j].second.second;
        int r1=v[i].first,r2=v[j].first;
        int x1=v[i].second.first.first,x2=v[j].second.first.first;
        int y1=v[i].second.first.second,y2=v[j].second.first.second;

        if (ans[indx1]!=-1 || ans[indx2]!=-1) continue;

        int dfx=x1-x2,dfy=y1-y2;
        dfx*=dfx; dfy*=dfy;
        int dfr=r1+r2; dfr*=dfr;
        if (dfr>=dfx+dfy) ans[indx2]=indx1+1;
      }
    }

    for (int i=0;i<n;i++) {
      if (ans[i]==-1) ans[i]=i+1;
      cout<<ans[i]<<' ';
    }
}
# 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 1 ms 212 KB Output is correct
5 Correct 0 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 1 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 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 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 2 ms 340 KB Output is correct
19 Correct 21 ms 508 KB Output is correct
20 Correct 12 ms 468 KB Output is correct
21 Correct 20 ms 516 KB Output is correct
22 Correct 22 ms 492 KB Output is correct
23 Correct 42 ms 500 KB Output is correct
24 Correct 21 ms 468 KB Output is correct
25 Correct 24 ms 468 KB Output is correct
26 Correct 21 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3049 ms 11988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 3047 ms 4196 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 11988 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 1 ms 212 KB Output is correct
5 Correct 0 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 1 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 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 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 2 ms 340 KB Output is correct
19 Correct 21 ms 508 KB Output is correct
20 Correct 12 ms 468 KB Output is correct
21 Correct 20 ms 516 KB Output is correct
22 Correct 22 ms 492 KB Output is correct
23 Correct 42 ms 500 KB Output is correct
24 Correct 21 ms 468 KB Output is correct
25 Correct 24 ms 468 KB Output is correct
26 Correct 21 ms 512 KB Output is correct
27 Correct 42 ms 980 KB Output is correct
28 Correct 49 ms 1000 KB Output is correct
29 Correct 40 ms 992 KB Output is correct
30 Correct 119 ms 956 KB Output is correct
31 Correct 90 ms 944 KB Output is correct
32 Correct 107 ms 952 KB Output is correct
33 Execution timed out 3039 ms 6740 KB Time limit exceeded
34 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 1 ms 212 KB Output is correct
5 Correct 0 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 1 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 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 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 2 ms 340 KB Output is correct
19 Correct 21 ms 508 KB Output is correct
20 Correct 12 ms 468 KB Output is correct
21 Correct 20 ms 516 KB Output is correct
22 Correct 22 ms 492 KB Output is correct
23 Correct 42 ms 500 KB Output is correct
24 Correct 21 ms 468 KB Output is correct
25 Correct 24 ms 468 KB Output is correct
26 Correct 21 ms 512 KB Output is correct
27 Execution timed out 3049 ms 11988 KB Time limit exceeded
28 Halted 0 ms 0 KB -