Submission #120773

# Submission time Handle Problem Language Result Execution time Memory
120773 2019-06-25T12:38:10 Z _demon_ Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 74208 KB
#include <bits/stdc++.h>
using namespace std;
int n;
int ans[100009];
struct xxx{
    long double r,x,y,id;
};
bool operator < (xxx a,xxx b){
    if(a.r==b.r) return a.id>b.id;
    return a.r<b.r;
}
set<xxx> s;
int main(){
    cin>>n;
    for(long double i=0;i<n;i++){
        long double r,x,y;
        cin>>x>>y>>r;
        s.insert({r,x,y,i});
    }
    while(s.size()>0){
        vector<xxx>v;
        v.clear();
        long double r=s.rbegin()->r;
        long double x=s.rbegin()->x;
        long double y=s.rbegin()->y;
        long double id=s.rbegin()->id;
        ans[(int)id]=id+1;
        s.erase({r,x,y,id});
        for(set<xxx>::iterator i=s.begin();i!=s.end();i++){
            long double rr=i->r;
            long double xx=i->x;
            long double yy=i->y;
            long double idd=i->id;
            long double dis=sqrt(pow(abs(xx-x),2)+pow(abs(yy-y),2));
            if(dis<=rr+r){
                v.push_back({rr,xx,yy,idd});
            }
       }
        for(int i=0;i<v.size();i++){
            long double rr=v[i].r;
            long double xx=v[i].x;
            long double yy=v[i].y;
            long double idd=v[i].id;
            s.erase({rr,xx,yy,idd});
            ans[(int)idd]=id+1;
        }
    }
    for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    cout<<endl;
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:39:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v.size();i++){
                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 4 ms 640 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 4 ms 640 KB Output is correct
19 Correct 14 ms 1660 KB Output is correct
20 Correct 14 ms 1660 KB Output is correct
21 Correct 15 ms 1408 KB Output is correct
22 Correct 337 ms 1064 KB Output is correct
23 Correct 333 ms 1144 KB Output is correct
24 Correct 403 ms 1112 KB Output is correct
25 Correct 347 ms 1064 KB Output is correct
26 Correct 340 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 874 ms 73136 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Execution timed out 3040 ms 14572 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2958 ms 74208 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 4 ms 640 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 4 ms 640 KB Output is correct
19 Correct 14 ms 1660 KB Output is correct
20 Correct 14 ms 1660 KB Output is correct
21 Correct 15 ms 1408 KB Output is correct
22 Correct 337 ms 1064 KB Output is correct
23 Correct 333 ms 1144 KB Output is correct
24 Correct 403 ms 1112 KB Output is correct
25 Correct 347 ms 1064 KB Output is correct
26 Correct 340 ms 1100 KB Output is correct
27 Correct 29 ms 2904 KB Output is correct
28 Correct 31 ms 2928 KB Output is correct
29 Correct 27 ms 2932 KB Output is correct
30 Correct 1609 ms 1884 KB Output is correct
31 Correct 1559 ms 1776 KB Output is correct
32 Correct 1588 ms 1876 KB Output is correct
33 Correct 334 ms 22756 KB Output is correct
34 Correct 365 ms 22728 KB Output is correct
35 Correct 377 ms 22728 KB Output is correct
36 Execution timed out 3021 ms 14380 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 4 ms 640 KB Output is correct
17 Correct 4 ms 512 KB Output is correct
18 Correct 4 ms 640 KB Output is correct
19 Correct 14 ms 1660 KB Output is correct
20 Correct 14 ms 1660 KB Output is correct
21 Correct 15 ms 1408 KB Output is correct
22 Correct 337 ms 1064 KB Output is correct
23 Correct 333 ms 1144 KB Output is correct
24 Correct 403 ms 1112 KB Output is correct
25 Correct 347 ms 1064 KB Output is correct
26 Correct 340 ms 1100 KB Output is correct
27 Runtime error 874 ms 73136 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -