#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 |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
296 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
2 ms |
460 KB |
Output is correct |
17 |
Correct |
2 ms |
440 KB |
Output is correct |
18 |
Correct |
2 ms |
444 KB |
Output is correct |
19 |
Correct |
8 ms |
1196 KB |
Output is correct |
20 |
Correct |
8 ms |
1208 KB |
Output is correct |
21 |
Correct |
8 ms |
1100 KB |
Output is correct |
22 |
Correct |
161 ms |
844 KB |
Output is correct |
23 |
Correct |
146 ms |
840 KB |
Output is correct |
24 |
Correct |
148 ms |
852 KB |
Output is correct |
25 |
Correct |
149 ms |
840 KB |
Output is correct |
26 |
Correct |
151 ms |
844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
574 ms |
40288 KB |
Output is correct |
2 |
Correct |
639 ms |
45576 KB |
Output is correct |
3 |
Correct |
628 ms |
40804 KB |
Output is correct |
4 |
Correct |
594 ms |
47072 KB |
Output is correct |
5 |
Execution timed out |
3084 ms |
30788 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
3099 ms |
11692 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3098 ms |
23768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
296 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
2 ms |
460 KB |
Output is correct |
17 |
Correct |
2 ms |
440 KB |
Output is correct |
18 |
Correct |
2 ms |
444 KB |
Output is correct |
19 |
Correct |
8 ms |
1196 KB |
Output is correct |
20 |
Correct |
8 ms |
1208 KB |
Output is correct |
21 |
Correct |
8 ms |
1100 KB |
Output is correct |
22 |
Correct |
161 ms |
844 KB |
Output is correct |
23 |
Correct |
146 ms |
840 KB |
Output is correct |
24 |
Correct |
148 ms |
852 KB |
Output is correct |
25 |
Correct |
149 ms |
840 KB |
Output is correct |
26 |
Correct |
151 ms |
844 KB |
Output is correct |
27 |
Correct |
19 ms |
1968 KB |
Output is correct |
28 |
Correct |
16 ms |
1968 KB |
Output is correct |
29 |
Correct |
17 ms |
2000 KB |
Output is correct |
30 |
Correct |
872 ms |
1396 KB |
Output is correct |
31 |
Correct |
860 ms |
1388 KB |
Output is correct |
32 |
Correct |
804 ms |
1396 KB |
Output is correct |
33 |
Correct |
235 ms |
15476 KB |
Output is correct |
34 |
Correct |
185 ms |
15424 KB |
Output is correct |
35 |
Correct |
227 ms |
15204 KB |
Output is correct |
36 |
Execution timed out |
3023 ms |
11408 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
296 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
2 ms |
460 KB |
Output is correct |
17 |
Correct |
2 ms |
440 KB |
Output is correct |
18 |
Correct |
2 ms |
444 KB |
Output is correct |
19 |
Correct |
8 ms |
1196 KB |
Output is correct |
20 |
Correct |
8 ms |
1208 KB |
Output is correct |
21 |
Correct |
8 ms |
1100 KB |
Output is correct |
22 |
Correct |
161 ms |
844 KB |
Output is correct |
23 |
Correct |
146 ms |
840 KB |
Output is correct |
24 |
Correct |
148 ms |
852 KB |
Output is correct |
25 |
Correct |
149 ms |
840 KB |
Output is correct |
26 |
Correct |
151 ms |
844 KB |
Output is correct |
27 |
Correct |
574 ms |
40288 KB |
Output is correct |
28 |
Correct |
639 ms |
45576 KB |
Output is correct |
29 |
Correct |
628 ms |
40804 KB |
Output is correct |
30 |
Correct |
594 ms |
47072 KB |
Output is correct |
31 |
Execution timed out |
3084 ms |
30788 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |