# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
102388 | tjdgus4384 | 원 고르기 (APIO18_circle_selection) | C++14 | 3091 ms | 21384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |