# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
393328 | Nima_Naderi | Circle selection (APIO18_circle_selection) | C++14 | 81 ms | 836 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.
//In the name of God
//#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll MXN = 5e3 + 10;
ll n;
ll X[MXN], Y[MXN], R[MXN], A[MXN];
bool Crs(ll i, ll j){
ll dis = (X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]);
return (dis <= (R[j] + R[i]) * (R[i] + R[j]));
}
set<pll> st;
void Rm(ll i){
auto itr = st.find({-R[i], i});
st.erase(itr);
}
int main(){
ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++) cin >> X[i] >> Y[i] >> R[i];
for(int i = 1; i <= n; i ++) st.insert({-R[i], i});
while(!st.empty()){
ll i = st.begin() -> second;
Rm(i), A[i] = i;
for(int j = 1; j <= n; j ++){
if(!A[j] && Crs(i, j)) A[j] = i, Rm(j);
}
}
for(int i = 1; i <= n; i ++) cout << A[i] << ' '; cout << '\n';
return 0;
}
//! N.N
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... |