이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxN = 3*1e5+1;
ll n;
//radius, index, pos.x, pos.y
set<pair<ll, pair<ll, pair<ll, ll>>>> a;
ll removedBy[maxN];
ll square(ll a){
return a*a;
}
int main()
{
cin>>n;
for(int i = 1; i <= n; i++){
ll b, c, d;
cin>>b>>c>>d;
a.insert({-d, {i,{b, c}}});
}
while(!a.empty()){
pair<ll, pair<ll, pair<ll, ll>>> temp = (*a.begin());
ll r=temp.first, ind=temp.second.first, posX=temp.second.second.first, posY=temp.second.second.second;
a.erase(a.begin());
removedBy[ind]=ind;
vector<pair<ll, pair<ll, pair<ll, ll>>>> removeList;
for(auto x : a){
if(square(abs(x.second.second.first-posX))+square(abs(x.second.second.second-posY))<=square((r*-1)+(x.first*-1)))removeList.push_back(x);
}
for(auto x : removeList){
a.erase(a.find(x));
removedBy[x.second.first]=ind;
}
}
for(int i = 1; i <= n; i++){
cout<<removedBy[i]<<" ";
}
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... |