Submission #932339

# Submission time Handle Problem Language Result Execution time Memory
932339 2024-02-23T08:27:14 Z salmon Circle selection (APIO18_circle_selection) C++14
0 / 100
4 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;

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

int main(){

    scanf(" %d",&N);

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

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

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

    for(int i = 0; i < N; i++){
        if(dead[i]) 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(" %d",&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(" %d",&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(" %d",&r[i]);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 1372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 1372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -