Submission #164724

# Submission time Handle Problem Language Result Execution time Memory
164724 2019-11-22T18:06:45 Z Rouge_Hugo Circle selection (APIO18_circle_selection) C++14
7 / 100
3000 ms 1912 KB
#include <bits/stdc++.h>
#define ll long long
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int n;
const int N=5007;
int vis[N],r[N];pair<int,int>a[N];
set<pair<int,int>>s;
bool check(int c1,int c2)
{
    long long x=a[c1].first-a[c2].first;x*=x;
    long long y=a[c1].second-a[c2].second;y*=y;
    ll rr=r[c1]+r[c2];rr*=rr;
    if (x+y<=rr)return 1;
    return false;

}
void cl(int ind)
{
    for(int i=0;i<n;i++)
    {
        if (vis[i])continue;
        if (check(ind,i))
        {
            s.erase({r[i],-i});
            vis[i]=ind+1;
        }
    }
}
int main()
{
    fast
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int x,y,z;
        cin>>x>>y>>z;
        a[i].first=x;a[i].second=y;
        r[i]=z;
    }
    for(int i=0;i<n;i++)
    {
        s.insert({r[i],-i});
    }
    while (!s.empty())
    {
        pair<int,int>x=*s.rbegin();
        cl(-x.second);
    }
    for(int i=0;i<n;i++)cout<<vis[i]<<" ";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 296 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 504 KB Output is correct
19 Correct 8 ms 888 KB Output is correct
20 Correct 7 ms 888 KB Output is correct
21 Correct 8 ms 888 KB Output is correct
22 Correct 114 ms 760 KB Output is correct
23 Correct 122 ms 760 KB Output is correct
24 Correct 113 ms 888 KB Output is correct
25 Correct 118 ms 760 KB Output is correct
26 Correct 113 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 632 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 376 KB Output is correct
2 Runtime error 9 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3045 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 296 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 504 KB Output is correct
19 Correct 8 ms 888 KB Output is correct
20 Correct 7 ms 888 KB Output is correct
21 Correct 8 ms 888 KB Output is correct
22 Correct 114 ms 760 KB Output is correct
23 Correct 122 ms 760 KB Output is correct
24 Correct 113 ms 888 KB Output is correct
25 Correct 118 ms 760 KB Output is correct
26 Correct 113 ms 860 KB Output is correct
27 Runtime error 21 ms 1912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 296 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 504 KB Output is correct
19 Correct 8 ms 888 KB Output is correct
20 Correct 7 ms 888 KB Output is correct
21 Correct 8 ms 888 KB Output is correct
22 Correct 114 ms 760 KB Output is correct
23 Correct 122 ms 760 KB Output is correct
24 Correct 113 ms 888 KB Output is correct
25 Correct 118 ms 760 KB Output is correct
26 Correct 113 ms 860 KB Output is correct
27 Runtime error 7 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Halted 0 ms 0 KB -