Submission #932346

# Submission time Handle Problem Language Result Execution time Memory
932346 2024-02-23T08:32:53 Z salmon Circle selection (APIO18_circle_selection) C++14
7 / 100
44 ms 1116 KB
#include <bits/stdc++.h>
using namespace std;

long long int x[5100];
long long int y[5100];
long long int r[5100];
vector<pair<long long int,int>> v;
int N;
bool dead[5100];
int killer[5100];

int main(){

    scanf(" %d",&N);

    for(int i = 0; i < N; i++){
        scanf(" %lld",&x[i]);
        scanf(" %lld",&y[i]);
        scanf(" %lld",&r[i]);

        v.push_back(make_pair(r[i],-i));
        dead[i] = false;
    }

    sort(v.begin(),v.end(),greater<pair<long long int,int>>());

    for(int i = 0; i < N; i++){
        if(dead[-v[i].second]) continue;

        int i1 = -v[i].second;

        for(int j = 0; j < N; j++){
            if(dead[j]) continue;
            if( (long long int)(r[j] + r[i1]) * (r[j] + r[i1]) >= (long long int)(x[j] - x[i1]) * (x[j] - x[i1]) + (long long int) (y[j] - y[i1]) * (y[j] - y[i1]) ){
                dead[j] = true;
                killer[j] = i1;
            }
        }
    }

    for(int i = 0 ; i < N; i++){
        printf("%d ",killer[i] + 1);
    }

}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
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",&x[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
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",&y[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
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",&r[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 440 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 968 KB Output is correct
20 Correct 3 ms 964 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 41 ms 860 KB Output is correct
23 Correct 41 ms 860 KB Output is correct
24 Correct 41 ms 924 KB Output is correct
25 Correct 44 ms 1000 KB Output is correct
26 Correct 41 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 2 ms 1116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 440 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 968 KB Output is correct
20 Correct 3 ms 964 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 41 ms 860 KB Output is correct
23 Correct 41 ms 860 KB Output is correct
24 Correct 41 ms 924 KB Output is correct
25 Correct 44 ms 1000 KB Output is correct
26 Correct 41 ms 860 KB Output is correct
27 Incorrect 3 ms 860 KB Output isn't correct
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 440 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 968 KB Output is correct
20 Correct 3 ms 964 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 41 ms 860 KB Output is correct
23 Correct 41 ms 860 KB Output is correct
24 Correct 41 ms 924 KB Output is correct
25 Correct 44 ms 1000 KB Output is correct
26 Correct 41 ms 860 KB Output is correct
27 Incorrect 2 ms 600 KB Output isn't correct
28 Halted 0 ms 0 KB -