Submission #102386

# Submission time Handle Problem Language Result Execution time Memory
102386 2019-03-24T15:17:08 Z tjdgus4384 Circle selection (APIO18_circle_selection) C++14
Compilation error
0 ms 0 KB
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
vector<pair<pair<long long int, long long int>, pair<long long int, long long int> > > v;
vector<long long int> answer;
bool visited[500003];

bool can(long long int a, long long int b){
    long long int ax = v[a].second.first;
    long long int ay = v[a].second.second;
    long long int bx = v[b].second.first;
    long long int by = v[b].second.second;
    long long long long int x = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
    long long long long int y = (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first);
    return (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first) >= x;
}

int main(){
    long long int n;
    scanf("%lld", &n);
    v.resize(n + 1);
    answer.resize(n + 1);
    for(long long int i = 1;i <= n;i++){
        scanf("%lld %lld %lld", &v[i].second.first, &v[i].second.second, &v[i].first.first);
        v[i].first.second = i;
        v[i].first.first = -v[i].first.first;
    }
    sort(v.begin() + 1, v.end());
    for(long long int i = 1;i <= n;i++){
        if(visited[i]) continue;
        for(long long int j = 1;j <= n;j++){
            if(visited[j]) continue;
            if(can(i, j)){
                answer[v[j].first.second] = v[i].first.second;
                visited[j] = true;
            }
        }
    }
    for(long long int i = 1;i <= n;i++){
        printf("%lld ", answer[i]);
    }
    return 0;
}

Compilation message

circle_selection.cpp: In function 'bool can(long long int, long long int)':
circle_selection.cpp:15:15: error: 'long long long' is too long for GCC
     long long long long int x = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
               ^~~~
circle_selection.cpp:15:20: error: 'long long long' is too long for GCC
     long long long long int x = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
                    ^~~~
circle_selection.cpp:16:15: error: 'long long long' is too long for GCC
     long long long long int y = (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first);
               ^~~~
circle_selection.cpp:16:20: error: 'long long long' is too long for GCC
     long long long long int y = (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first);
                    ^~~~
circle_selection.cpp:16:29: warning: unused variable 'y' [-Wunused-variable]
     long long long long int y = (v[a].first.first + v[b].first.first) * (v[a].first.first + v[b].first.first);
                             ^
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &n);
     ~~~~~^~~~~~~~~~~~
circle_selection.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld %lld", &v[i].second.first, &v[i].second.second, &v[i].first.first);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~