#include <bits/stdc++.h>
using namespace std;
#define int long long
bool inte(vector<int> c,vector<int> c1)
{
int dis=(c[2]-c1[2])*(c[2]-c1[2])+(c[3]-c1[3])*(c[3]-c1[3]);
return dis <= (c[0]+c1[0])*(c[0]+c1[0]);
}
signed main()
{
int n;
cin>>n;
int r[n],x[n],y[n],ans[n]={};
if (n<=5000)
{
set<vector<int>> se;
set<int> rem;
for (int i=0;i<n;i++)
{
cin>>x[i]>>y[i]>>r[i];
se.insert({-r[i],i,x[i],y[i]});
rem.insert(i);
}
while (!se.empty())
{
auto it=se.begin();
vector<int> c=*it;c[0]*=-1;
for (int i:rem)
if (!ans[i] && inte(c,{r[i],i,x[i],y[i]}))
{
se.erase({-r[i],i,x[i],y[i]});
ans[i]=c[1]+1;
}
}
}
else
{
int mx=-1e9,mn=-mx;
for (int i=0;i<n;i++)
cin>>x[i]>>y[i]>>r[i],mn=min(mn,y[i]),mx=max(mx,y[i]);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
214 ms |
13256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
232 ms |
13656 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |