Submission #439980

# Submission time Handle Problem Language Result Execution time Memory
439980 2021-07-01T10:31:13 Z DJeniUp Circle selection (APIO18_circle_selection) C++17
7 / 100
449 ms 19432 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll>pairll;
typedef pair<ll,pairll>pairlll;
typedef pair<pairll,pairll>pairllll;
typedef long double ld;
typedef pair<ll,string>pairls;

#define INF 1000000000000007
#define pb push_back
#define fr first
#define sc second

ll n;

struct D{
    ll x,y,r,N;
}d[300007];

bool mcp(D d1, D d2){
    if(d1.r!=d2.r)return d1.r>d2.r;
    return d1.N<d2.N;
}

void RES(){
    ll res[5007];
    sort(d+1,d+1+n,mcp);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            if((d[j].x-d[i].x)*(d[j].x-d[i].x)+(d[j].y-d[i].y)*(d[j].y-d[i].y)<=(d[j].r+d[i].r)*(d[j].r+d[i].r) && (res[d[j].N]==d[j].N || i==j)){
                res[d[i].N]=d[j].N;
                break;
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<res[i]<<" ";
    }
    cout<<endl;
    return ;
}

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>d[i].x>>d[i].y>>d[i].r;
        d[i].N=i;
    }
    //if(n<=5000){
        RES();
        return 0;
    //}

    return 0;
}
/*

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

*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 9 ms 460 KB Output is correct
20 Correct 9 ms 460 KB Output is correct
21 Correct 9 ms 460 KB Output is correct
22 Correct 27 ms 488 KB Output is correct
23 Correct 28 ms 460 KB Output is correct
24 Correct 27 ms 496 KB Output is correct
25 Correct 29 ms 460 KB Output is correct
26 Correct 27 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 406 ms 19432 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Runtime error 153 ms 6812 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 449 ms 19400 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 9 ms 460 KB Output is correct
20 Correct 9 ms 460 KB Output is correct
21 Correct 9 ms 460 KB Output is correct
22 Correct 27 ms 488 KB Output is correct
23 Correct 28 ms 460 KB Output is correct
24 Correct 27 ms 496 KB Output is correct
25 Correct 29 ms 460 KB Output is correct
26 Correct 27 ms 476 KB Output is correct
27 Runtime error 17 ms 1012 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 9 ms 460 KB Output is correct
20 Correct 9 ms 460 KB Output is correct
21 Correct 9 ms 460 KB Output is correct
22 Correct 27 ms 488 KB Output is correct
23 Correct 28 ms 460 KB Output is correct
24 Correct 27 ms 496 KB Output is correct
25 Correct 29 ms 460 KB Output is correct
26 Correct 27 ms 476 KB Output is correct
27 Runtime error 406 ms 19432 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -