#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define intt long long
#define mid (l+r)/2
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
intt n;
cin>>n;
vector<pair<intt,pair<intt,intt>>>v;
map<intt,intt>m;
for(int i=0;i<n;i++)
{
intt x,y,r;
cin>>x>>y>>r;
v.push_back({r,{x,y}});
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(int i=0;i<n;i++)
{
if(!m[i])
{
m[i]=i;
intt x=v[i].second.first;
intt y=v[i].second.second;
intt r=v[i].first;
for(int j=0;j<n;j++)
{
if(!m[j])
{
intt x1=v[j].second.first;
intt y1=v[j].second.second;
intt r1=v[j].first;
double h=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
if(h<=r)
{
m[j]=i;
}
}
}
}
}
for(auto u:m)
cout<<u.second+1<<" ";
return 0;
}
Compilation message
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:39:26: warning: unused variable 'r1' [-Wunused-variable]
39 | intt r1=v[j].first;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
332 ms |
33472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3013 ms |
33932 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |