Submission #123991

# Submission time Handle Problem Language Result Execution time Memory
123991 2019-07-02T10:31:47 Z hani Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 22036 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct cir
{
    ll x,y,r,in;
    bool eliminated;
};
bool comp(cir a,cir b)
{
    if(a.r==b.r) return a.in<b.in;
     return a.r>b.r;
}
bool inter(cir a,cir b)
{
    long long g=(a.r+b.r)*(a.r+b.r), p=(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
    if   ( g>=p) return true;
    return false;
}
int main()
{
    int n; cin>>n;
    cir t[n];
    for(int i=0;i<n;i++)
    {
        ll x,y,r;
        scanf("%lld%lld%lld",&x,&y,&r );
        t[i].x=x; t[i].y=y; t[i].r=r; t[i].in=i+1; t[i].eliminated=0;
    }
    sort(t,t+n,comp);
    //for(int i=0;i<n;i++){printf("%d %d %d %d \n",t[i].x,t[i].y,t[i].r,t[i].in);}
    int eliminations[n+1];
    for (int i=0;i<n;i++)
    {
        if(!t[i].eliminated)
        {
            eliminations[t[i].in]=t[i].in;
            for(int j=i+1;j<n;j++)
            {
                if(inter(t[i],t[j]) && !t[j].eliminated)
                {
                    eliminations[t[j].in]=t[i].in;
                    t[j].eliminated=true;
                }
            }
            t[i].eliminated=true;
        }
    }
    for(int i=1;i<=n;i++) cout<<eliminations[i]<<" ";

}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld",&x,&y,&r );
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 380 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 6 ms 760 KB Output is correct
20 Correct 6 ms 632 KB Output is correct
21 Correct 6 ms 760 KB Output is correct
22 Correct 29 ms 632 KB Output is correct
23 Correct 30 ms 732 KB Output is correct
24 Correct 29 ms 632 KB Output is correct
25 Correct 29 ms 632 KB Output is correct
26 Correct 30 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 240 ms 22032 KB Output is correct
2 Correct 239 ms 22008 KB Output is correct
3 Correct 239 ms 21752 KB Output is correct
4 Correct 245 ms 22036 KB Output is correct
5 Correct 2125 ms 19700 KB Output is correct
6 Execution timed out 3042 ms 18040 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB Output is correct
2 Execution timed out 3027 ms 7448 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3034 ms 14864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 380 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 6 ms 760 KB Output is correct
20 Correct 6 ms 632 KB Output is correct
21 Correct 6 ms 760 KB Output is correct
22 Correct 29 ms 632 KB Output is correct
23 Correct 30 ms 732 KB Output is correct
24 Correct 29 ms 632 KB Output is correct
25 Correct 29 ms 632 KB Output is correct
26 Correct 30 ms 632 KB Output is correct
27 Correct 10 ms 1144 KB Output is correct
28 Correct 10 ms 1192 KB Output is correct
29 Correct 10 ms 1016 KB Output is correct
30 Correct 108 ms 1056 KB Output is correct
31 Correct 108 ms 1048 KB Output is correct
32 Correct 107 ms 1060 KB Output is correct
33 Correct 87 ms 8308 KB Output is correct
34 Correct 88 ms 8260 KB Output is correct
35 Correct 90 ms 8184 KB Output is correct
36 Execution timed out 3013 ms 7196 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 3 ms 380 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 6 ms 760 KB Output is correct
20 Correct 6 ms 632 KB Output is correct
21 Correct 6 ms 760 KB Output is correct
22 Correct 29 ms 632 KB Output is correct
23 Correct 30 ms 732 KB Output is correct
24 Correct 29 ms 632 KB Output is correct
25 Correct 29 ms 632 KB Output is correct
26 Correct 30 ms 632 KB Output is correct
27 Correct 240 ms 22032 KB Output is correct
28 Correct 239 ms 22008 KB Output is correct
29 Correct 239 ms 21752 KB Output is correct
30 Correct 245 ms 22036 KB Output is correct
31 Correct 2125 ms 19700 KB Output is correct
32 Execution timed out 3042 ms 18040 KB Time limit exceeded
33 Halted 0 ms 0 KB -