#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;
int32_t main()
{
map<int,set<pair<int,int> >,greater<int> >circles;
map<pair<pair<int,int>,int>,int> memo;
vector<pair<pair<int,int>,int> > tab;
vector<int> res;
int n;
int x,y,z;
scanf("%llu",&n);
res.resize(n);
for(int i=0; i<n; i++)
{
scanf("%llu%llu%llu",&x,&y,&z);
circles[z].insert(make_pair(x,y));
memo[make_pair(make_pair(x,y),z)]=i;
tab.push_back(make_pair(make_pair(x,y),z));
res[i]=i+1;
}
map<int,set<pair<int,int> >,greater<int> >::iterator it;
int done=0;
while(done<=n)
{
bool test=0;
int a,b,c;
it=circles.begin();
while((it->second).size()==0)
{
it++;
}
c=it->first;
a=((it->second).begin())->first;
b=((it->second).begin())->second;
(it->second).erase((it->second).begin());
done++;
for(it=circles.begin(); it!=circles.end(); ++it)
{
int r=it->first;
set<pair<int,int> >::iterator posi;
for(posi=(it->second).begin(); posi!=(it->second).end(); ++posi)
{
int q=posi->first;
int p=posi->second;
if((c+r)*(c+r)>=(q-a)*(q-a)+(p-b)*(p-b))
{
done++;
res[memo[make_pair(make_pair(q,p),r)]]=memo[make_pair(make_pair(a,b),c)]+1;
(it->second).erase(posi);
}
}
}
}
for(int i=0; i<n; i++)
{
printf("%llu ",res[i]);
}
return 0;
}
Compilation message
circle_selection.cpp: In function 'int32_t main()':
circle_selection.cpp:28:14: warning: unused variable 'test' [-Wunused-variable]
bool test=0;
^~~~
circle_selection.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%llu",&n);
~~~~~^~~~~~~~~~~
circle_selection.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%llu%llu%llu",&x,&y,&z);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
380 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
4 ms |
632 KB |
Output is correct |
17 |
Correct |
3 ms |
636 KB |
Output is correct |
18 |
Correct |
3 ms |
632 KB |
Output is correct |
19 |
Correct |
12 ms |
1912 KB |
Output is correct |
20 |
Correct |
12 ms |
1912 KB |
Output is correct |
21 |
Correct |
14 ms |
1912 KB |
Output is correct |
22 |
Correct |
1068 ms |
1788 KB |
Output is correct |
23 |
Correct |
850 ms |
1784 KB |
Output is correct |
24 |
Correct |
1127 ms |
1912 KB |
Output is correct |
25 |
Correct |
959 ms |
1776 KB |
Output is correct |
26 |
Correct |
1120 ms |
1784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1685 ms |
82268 KB |
Output is correct |
2 |
Correct |
1604 ms |
88204 KB |
Output is correct |
3 |
Correct |
1595 ms |
88080 KB |
Output is correct |
4 |
Correct |
1663 ms |
88336 KB |
Output is correct |
5 |
Execution timed out |
3068 ms |
56472 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
3056 ms |
28408 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3055 ms |
52088 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
380 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
4 ms |
632 KB |
Output is correct |
17 |
Correct |
3 ms |
636 KB |
Output is correct |
18 |
Correct |
3 ms |
632 KB |
Output is correct |
19 |
Correct |
12 ms |
1912 KB |
Output is correct |
20 |
Correct |
12 ms |
1912 KB |
Output is correct |
21 |
Correct |
14 ms |
1912 KB |
Output is correct |
22 |
Correct |
1068 ms |
1788 KB |
Output is correct |
23 |
Correct |
850 ms |
1784 KB |
Output is correct |
24 |
Correct |
1127 ms |
1912 KB |
Output is correct |
25 |
Correct |
959 ms |
1776 KB |
Output is correct |
26 |
Correct |
1120 ms |
1784 KB |
Output is correct |
27 |
Correct |
27 ms |
3408 KB |
Output is correct |
28 |
Correct |
23 ms |
3380 KB |
Output is correct |
29 |
Correct |
22 ms |
3380 KB |
Output is correct |
30 |
Execution timed out |
3042 ms |
2996 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
380 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
4 ms |
632 KB |
Output is correct |
17 |
Correct |
3 ms |
636 KB |
Output is correct |
18 |
Correct |
3 ms |
632 KB |
Output is correct |
19 |
Correct |
12 ms |
1912 KB |
Output is correct |
20 |
Correct |
12 ms |
1912 KB |
Output is correct |
21 |
Correct |
14 ms |
1912 KB |
Output is correct |
22 |
Correct |
1068 ms |
1788 KB |
Output is correct |
23 |
Correct |
850 ms |
1784 KB |
Output is correct |
24 |
Correct |
1127 ms |
1912 KB |
Output is correct |
25 |
Correct |
959 ms |
1776 KB |
Output is correct |
26 |
Correct |
1120 ms |
1784 KB |
Output is correct |
27 |
Correct |
1685 ms |
82268 KB |
Output is correct |
28 |
Correct |
1604 ms |
88204 KB |
Output is correct |
29 |
Correct |
1595 ms |
88080 KB |
Output is correct |
30 |
Correct |
1663 ms |
88336 KB |
Output is correct |
31 |
Execution timed out |
3068 ms |
56472 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |