답안 #88922

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88922 2018-12-09T20:04:04 Z asifthegreat 원 고르기 (APIO18_circle_selection) C++14
0 / 100
211 ms 10596 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

const ll N = 500003;    

struct point{
    ll x,y,r,indx;
}points[N]; 

ll ans[N];

bool cmp(point a , point b)
{
    if(a.r != b.r)return a.r > b.r;
    return a.indx < b.indx;
}

bool tatatata(int i,int j)
{
    point a = points[i];
    point b = points[j];
    long long ppp = (a.x-b.x)*(a.x-b.x);
    ppp += (a.y-b.y)*(a.y-b.y);

    if((a.r+b.r)*(a.r+b.r) >= ppp)return true;return false;
}

int main()
{
    ll n,k;
    scanf("%lld",&n);
    for(int i = 1; i <= n;i++){
        scanf("%lld %lld %lld",&points[i].x,&points[i].y,&points[i].r);
        points[i].indx = i;
    }
    sort(points+1,points+1+n,cmp);
    if(n <= 5000){
        for(int i = 1; i <= n;i++){
            int ans_ = -1;
            for(int j = 1; j < i+1;j++){
                if(tatatata(i,j)){
                    ans[i] = j;
                    break;
                }
            }
        }
    }
    for(int i = 1; i <= n;i++){
        cout << ans[i] << " ";
    }cout << endl;


    return 0;
}

Compilation message

circle_selection.cpp: In function 'bool tatatata(int, int)':
circle_selection.cpp:27:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if((a.r+b.r)*(a.r+b.r) >= ppp)return true;return false;
     ^~
circle_selection.cpp:27:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     if((a.r+b.r)*(a.r+b.r) >= ppp)return true;return false;
                                               ^~~~~~
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:41:17: warning: unused variable 'ans_' [-Wunused-variable]
             int ans_ = -1;
                 ^~~~
circle_selection.cpp:32:10: warning: unused variable 'k' [-Wunused-variable]
     ll n,k;
          ^
circle_selection.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
circle_selection.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld %lld",&points[i].x,&points[i].y,&points[i].r);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 211 ms 10504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 10504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 190 ms 10596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 448 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 448 KB Output isn't correct
4 Halted 0 ms 0 KB -