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<iostream>
#include<vector>
#include<algorithm>
#define vel vector<long long>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pin pair<int,int>
#define mkp make_pair
#define sor(v) sort(v.begin(),v.end())
#define int long long
int sq(int n) { return n * n; }
int dist(vel &x, vel &y, int i, int j) {
return sq(x[i] - x[j]) + sq(y[i] - y[j]);
}
signed main() {
int n; cin >> n;
vel x(n), y(n), r(n);
vector<pin> al(n);
rep(i, n) { cin >> x[i] >> y[i] >> r[i]; al[i] = mkp(-r[i], i); }
vector<bool> is_kled(n, false);
vel ans(n);
sor(al);
rep(i, n) {
int ri = al[i].second;
if (!is_kled[ri]) {
rep(j, n) {
if (!is_kled[j] and (dist(x, y, ri, j) <= sq(r[ri] + r[j]) )) {
ans[j] = ri;
is_kled[j] = true;
}
}
}
}
rep(i, n) { cout << ans[i]+1<<endl; }
return 0;
}
# | 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... |