Submission #252469

# Submission time Handle Problem Language Result Execution time Memory
252469 2020-07-25T16:02:24 Z khangal Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 1048580 KB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<long long> vl;
typedef pair<long long , long long > pl;
const int N=1e6+1;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18 
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,ans,mid,mn,mx,cnt,T,sum,h1,h2,e[1234567],b[1234567],c[1234567],d[1<<20],k,i,j,l,h,a[1234567],w,x,y,z;
ll c1[123][123];
bool used[1234567],used1[1234567];
pl p[1234567];
string s,s1[1234567];
map<ll,ll> mp;
map<pl,ll> mpl;
vector<pl> vec,vec1,ansvec;
vector<ll> v[1234567],v1[1234567];
vector<ll> vp[1234567];
set<ll> st;
stack <ll> sta;
struct node{
    ll x,y,r,id;
}str[1234567];
vector<node> conn[1234567];
bool comp(node a,node b){
    if(a.r==b.r)return a.id<b.id;
    return a.r>b.r;
}
ll dist(ll x,ll y){
    return (str[x].x-str[y].x)*(str[x].x-str[y].x)+(str[x].y-str[y].y)*(str[x].y-str[y].y);
}
void connect(ll x){
    rep(i,1,n){
        if(i==x)continue;
        ll tmp=(str[i].r+str[x].r)*(str[i].r+str[x].r);
        if(dist(x , i) <= tmp){
            conn[x].pb(str[i]);
        }
    }
}
int main(){
    cin>>n;
    rep(i,1,n){
        cin>>str[i].x>>str[i].y>>str[i].r;
        str[i].id=i;
    }
    sort(str+1,str+n+1,comp);
    rep(i,1,n){
        connect(i);
    }
    rep(i,1,n){
        if(used[str[i].id]==1)continue;
        used[str[i].id]=1;
        d[str[i].id] = str[i].id;
        for(auto x : conn[i]){
            if(used[x.id]==1)continue;
            d[x.id] = str[i].id;
            used[x.id]=1;
        }
    }
    rep(i,1,n){
        cout<<d[i]<<" ";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 76 ms 155000 KB Output is correct
2 Correct 77 ms 154916 KB Output is correct
3 Correct 78 ms 155000 KB Output is correct
4 Correct 79 ms 155000 KB Output is correct
5 Correct 77 ms 155000 KB Output is correct
6 Correct 78 ms 155384 KB Output is correct
7 Correct 79 ms 155384 KB Output is correct
8 Correct 77 ms 155256 KB Output is correct
9 Correct 82 ms 155260 KB Output is correct
10 Correct 78 ms 155256 KB Output is correct
11 Correct 87 ms 155000 KB Output is correct
12 Correct 82 ms 155000 KB Output is correct
13 Correct 85 ms 155000 KB Output is correct
14 Correct 86 ms 155000 KB Output is correct
15 Correct 77 ms 155000 KB Output is correct
16 Correct 99 ms 181440 KB Output is correct
17 Correct 99 ms 179020 KB Output is correct
18 Correct 105 ms 186104 KB Output is correct
19 Correct 862 ms 934140 KB Output is correct
20 Correct 913 ms 958552 KB Output is correct
21 Correct 492 ms 644936 KB Output is correct
22 Correct 136 ms 155256 KB Output is correct
23 Correct 136 ms 155228 KB Output is correct
24 Correct 135 ms 155164 KB Output is correct
25 Correct 146 ms 155128 KB Output is correct
26 Correct 134 ms 155128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1858 ms 1048580 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 154976 KB Output is correct
2 Execution timed out 3058 ms 158524 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3083 ms 164816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 155000 KB Output is correct
2 Correct 77 ms 154916 KB Output is correct
3 Correct 78 ms 155000 KB Output is correct
4 Correct 79 ms 155000 KB Output is correct
5 Correct 77 ms 155000 KB Output is correct
6 Correct 78 ms 155384 KB Output is correct
7 Correct 79 ms 155384 KB Output is correct
8 Correct 77 ms 155256 KB Output is correct
9 Correct 82 ms 155260 KB Output is correct
10 Correct 78 ms 155256 KB Output is correct
11 Correct 87 ms 155000 KB Output is correct
12 Correct 82 ms 155000 KB Output is correct
13 Correct 85 ms 155000 KB Output is correct
14 Correct 86 ms 155000 KB Output is correct
15 Correct 77 ms 155000 KB Output is correct
16 Correct 99 ms 181440 KB Output is correct
17 Correct 99 ms 179020 KB Output is correct
18 Correct 105 ms 186104 KB Output is correct
19 Correct 862 ms 934140 KB Output is correct
20 Correct 913 ms 958552 KB Output is correct
21 Correct 492 ms 644936 KB Output is correct
22 Correct 136 ms 155256 KB Output is correct
23 Correct 136 ms 155228 KB Output is correct
24 Correct 135 ms 155164 KB Output is correct
25 Correct 146 ms 155128 KB Output is correct
26 Correct 134 ms 155128 KB Output is correct
27 Runtime error 734 ms 1048580 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 155000 KB Output is correct
2 Correct 77 ms 154916 KB Output is correct
3 Correct 78 ms 155000 KB Output is correct
4 Correct 79 ms 155000 KB Output is correct
5 Correct 77 ms 155000 KB Output is correct
6 Correct 78 ms 155384 KB Output is correct
7 Correct 79 ms 155384 KB Output is correct
8 Correct 77 ms 155256 KB Output is correct
9 Correct 82 ms 155260 KB Output is correct
10 Correct 78 ms 155256 KB Output is correct
11 Correct 87 ms 155000 KB Output is correct
12 Correct 82 ms 155000 KB Output is correct
13 Correct 85 ms 155000 KB Output is correct
14 Correct 86 ms 155000 KB Output is correct
15 Correct 77 ms 155000 KB Output is correct
16 Correct 99 ms 181440 KB Output is correct
17 Correct 99 ms 179020 KB Output is correct
18 Correct 105 ms 186104 KB Output is correct
19 Correct 862 ms 934140 KB Output is correct
20 Correct 913 ms 958552 KB Output is correct
21 Correct 492 ms 644936 KB Output is correct
22 Correct 136 ms 155256 KB Output is correct
23 Correct 136 ms 155228 KB Output is correct
24 Correct 135 ms 155164 KB Output is correct
25 Correct 146 ms 155128 KB Output is correct
26 Correct 134 ms 155128 KB Output is correct
27 Runtime error 1858 ms 1048580 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -