#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size();
#define pii pair<ll,ll>
#define f first
#define s second
using namespace std;
ll sq(ll a)
{
return a*a;
}
int ans[5001];
pair<pii,pii> p[5000];
int main()
{
int n;
cin>>n;
for (int i=0;i<n;++i)
{
cin>>p[i].s.f>>p[i].s.s>>p[i].f.f;
p[i].f.s=-(i+1);
}
sort(p,p+n,greater<pair<pii,pii>>());
for (int i=0;i<n;++i)
{
if (ans[-(p[i].f.s)])
continue;
for (int j=i;j<n;++j)
if (!ans[-(p[j].f.s)])
if (sq(p[i].s.f-p[j].s.f)+sq(p[i].s.s-p[j].s.s)<=sq(p[i].f.f+p[j].f.f))
ans[-(p[j].f.s)]=-(p[i].f.s);
}
for (int i=1;i<=n;++i)
cout<<ans[i]<<" ";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
3 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
14 ms |
640 KB |
Output is correct |
20 |
Correct |
15 ms |
640 KB |
Output is correct |
21 |
Correct |
14 ms |
640 KB |
Output is correct |
22 |
Correct |
45 ms |
760 KB |
Output is correct |
23 |
Correct |
40 ms |
640 KB |
Output is correct |
24 |
Correct |
42 ms |
640 KB |
Output is correct |
25 |
Correct |
39 ms |
672 KB |
Output is correct |
26 |
Correct |
40 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
1152 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Runtime error |
15 ms |
1152 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
14 ms |
1152 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
3 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
14 ms |
640 KB |
Output is correct |
20 |
Correct |
15 ms |
640 KB |
Output is correct |
21 |
Correct |
14 ms |
640 KB |
Output is correct |
22 |
Correct |
45 ms |
760 KB |
Output is correct |
23 |
Correct |
40 ms |
640 KB |
Output is correct |
24 |
Correct |
42 ms |
640 KB |
Output is correct |
25 |
Correct |
39 ms |
672 KB |
Output is correct |
26 |
Correct |
40 ms |
760 KB |
Output is correct |
27 |
Runtime error |
16 ms |
1024 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
3 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
14 ms |
640 KB |
Output is correct |
20 |
Correct |
15 ms |
640 KB |
Output is correct |
21 |
Correct |
14 ms |
640 KB |
Output is correct |
22 |
Correct |
45 ms |
760 KB |
Output is correct |
23 |
Correct |
40 ms |
640 KB |
Output is correct |
24 |
Correct |
42 ms |
640 KB |
Output is correct |
25 |
Correct |
39 ms |
672 KB |
Output is correct |
26 |
Correct |
40 ms |
760 KB |
Output is correct |
27 |
Runtime error |
13 ms |
1152 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |