#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<pair<intt,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,-i},{x,y}});
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(int i=0;i<n;i++)
{intt o=-v[i].first.second;
if(!m[o])
{intt x=v[i].second.first;
intt y=v[i].second.second;
intt r=v[i].first.first;
for(int j=0;j<n;j++)
{intt l=-v[j].first.second;
if(!m[l])
{
intt x1=v[j].second.first;
intt y1=v[j].second.second;
intt r1=v[j].first.first;
intt h=(x-x1)*(x-x1)+(y-y1)*(y-y1);
if(h<=(r+r1)*(r+r1))
{
m[l]=o+1;
}
}
}}
}
for(auto u:m)
cout<<u.second<<" ";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
316 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
360 KB |
Output is correct |
12 |
Correct |
1 ms |
312 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
224 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
976 KB |
Output is correct |
20 |
Correct |
5 ms |
976 KB |
Output is correct |
21 |
Correct |
8 ms |
984 KB |
Output is correct |
22 |
Correct |
2144 ms |
920 KB |
Output is correct |
23 |
Correct |
2097 ms |
920 KB |
Output is correct |
24 |
Correct |
2213 ms |
944 KB |
Output is correct |
25 |
Correct |
2093 ms |
920 KB |
Output is correct |
26 |
Correct |
2085 ms |
916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
586 ms |
30552 KB |
Output is correct |
2 |
Correct |
805 ms |
37212 KB |
Output is correct |
3 |
Correct |
671 ms |
36992 KB |
Output is correct |
4 |
Correct |
647 ms |
37308 KB |
Output is correct |
5 |
Execution timed out |
3071 ms |
33104 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
3058 ms |
12484 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3067 ms |
28448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
316 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
360 KB |
Output is correct |
12 |
Correct |
1 ms |
312 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
224 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
976 KB |
Output is correct |
20 |
Correct |
5 ms |
976 KB |
Output is correct |
21 |
Correct |
8 ms |
984 KB |
Output is correct |
22 |
Correct |
2144 ms |
920 KB |
Output is correct |
23 |
Correct |
2097 ms |
920 KB |
Output is correct |
24 |
Correct |
2213 ms |
944 KB |
Output is correct |
25 |
Correct |
2093 ms |
920 KB |
Output is correct |
26 |
Correct |
2085 ms |
916 KB |
Output is correct |
27 |
Correct |
17 ms |
1580 KB |
Output is correct |
28 |
Correct |
9 ms |
1628 KB |
Output is correct |
29 |
Correct |
9 ms |
1492 KB |
Output is correct |
30 |
Execution timed out |
3083 ms |
1476 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
316 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
360 KB |
Output is correct |
12 |
Correct |
1 ms |
312 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
224 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
5 ms |
976 KB |
Output is correct |
20 |
Correct |
5 ms |
976 KB |
Output is correct |
21 |
Correct |
8 ms |
984 KB |
Output is correct |
22 |
Correct |
2144 ms |
920 KB |
Output is correct |
23 |
Correct |
2097 ms |
920 KB |
Output is correct |
24 |
Correct |
2213 ms |
944 KB |
Output is correct |
25 |
Correct |
2093 ms |
920 KB |
Output is correct |
26 |
Correct |
2085 ms |
916 KB |
Output is correct |
27 |
Correct |
586 ms |
30552 KB |
Output is correct |
28 |
Correct |
805 ms |
37212 KB |
Output is correct |
29 |
Correct |
671 ms |
36992 KB |
Output is correct |
30 |
Correct |
647 ms |
37308 KB |
Output is correct |
31 |
Execution timed out |
3071 ms |
33104 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |