# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102388 | tjdgus4384 | Circle selection (APIO18_circle_selection) | C++14 | 3091 ms | 21384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 int x = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |