Submission #402192

# Submission time Handle Problem Language Result Execution time Memory
402192 2021-05-11T12:08:40 Z A_D Circle selection (APIO18_circle_selection) C++14
7 / 100
124 ms 1100 KB
#include <bits/stdc++.h>
#define int long long
#define ii pair<int,int>
#define F first
#define S second
#define du long double

using namespace std;
const int N=5010;
pair<ii,ii> a[N];
int vis[N];
void solve()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i].S.F);
        scanf("%lld",&a[i].S.S);
        scanf("%lld",&a[i].F.F);
        a[i].F.F*=-1;
        a[i].F.S=i;
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
        a[i].F.F*=-1;
    }
    int ans=0,t=n;
    while(t){
        ans++;
        int u=0;
        for(int i=1;i<=n;i++){
            if(vis[a[i].F.S]==0){
                vis[a[i].F.S]=a[i].F.S;
                t--;
                u=i;
                break;
            }
        }
        for(int i=1;i<=n;i++){
            if(vis[a[i].F.S]==0){
                du x=a[i].S.F-a[u].S.F;
                du y=a[i].S.S-a[u].S.S;
                du dis=sqrt(x*x+y*y);
                du re=a[i].F.F+a[u].F.F;
                if(re>=dis){
                    vis[a[i].F.S]=vis[a[u].F.S];
                    t--;
                }
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<vis[i]<<" ";
    }
}

main()
{
    int t=1;
//    cin>>t;
    while(t--)solve();
}
/*

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



*/

Compilation message

circle_selection.cpp:57:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   57 | main()
      | ^~~~
circle_selection.cpp: In function 'void solve()':
circle_selection.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%lld",&a[i].S.F);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
circle_selection.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%lld",&a[i].S.S);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
circle_selection.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%lld",&a[i].F.F);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 644 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
22 Correct 123 ms 600 KB Output is correct
23 Correct 122 ms 600 KB Output is correct
24 Correct 122 ms 616 KB Output is correct
25 Correct 124 ms 592 KB Output is correct
26 Correct 124 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 1100 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 4 ms 972 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 1032 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 644 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
22 Correct 123 ms 600 KB Output is correct
23 Correct 122 ms 600 KB Output is correct
24 Correct 122 ms 616 KB Output is correct
25 Correct 124 ms 592 KB Output is correct
26 Correct 124 ms 604 KB Output is correct
27 Runtime error 4 ms 972 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 4 ms 644 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
22 Correct 123 ms 600 KB Output is correct
23 Correct 122 ms 600 KB Output is correct
24 Correct 122 ms 616 KB Output is correct
25 Correct 124 ms 592 KB Output is correct
26 Correct 124 ms 604 KB Output is correct
27 Runtime error 4 ms 1100 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -