#include <bits/stdc++.h>
#define lp(i,a,b) for(int i = a; i < b ; i++)
#define ff first
#define ss second
#define pb emplace_back
#define ll long long
#define mk make_pair
#define sz(x) x.size()
#define pii pair<int,int>
#define mkt make_tuple
#define debug printf
const int MAXN = 5010 ;
using namespace std ;
struct Circle
{
ll x , y , r ;
int id ;
Circle(ll x = 0 , ll y = 0 , ll r = 0 , int id = 0 ) : x(x) , y(y) , r(r) , id(id) {}
bool operator < (Circle other) const
{
if(r == other.r) return id < other.id ;
return r > other.r ;
}
};
int N ;
int sai_para[MAXN] ;
set<Circle> s ;
void process()
{
Circle ptr = *s.begin() ;
vector<Circle> toDelete ;
for(auto e : s )
{
ll dist = (ptr.x - e.x) * (ptr.x - e.x) ;
dist += ( ptr.y - e.y ) * ( ptr.y - e.y ) ;
ll rad_quad = ptr.r + e.r ;
rad_quad *= rad_quad ;
if( dist > rad_quad ) continue ;
toDelete.pb( e ) ;
sai_para[ e.id ] = ptr.id ;
}
for(auto e : toDelete ) s.erase( s.find(e) ) ;
}
int main()
{
scanf("%d", &N ) ;
for(int i = 1 ; i <= N ; i++ )
{
ll x , y , r ;
scanf("%lld %lld %lld", &x, &y, &r ) ;
s.insert( Circle(x,y,r,i) ) ;
}
while( !s.empty() ) process() ;
lp(i,1,N+1) printf("%d%c", sai_para[i] , " \n"[i == N]) ;
}
Compilation message
circle_selection.cpp: In function 'int main()':
circle_selection.cpp:67:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
67 | scanf("%d", &N ) ;
| ~~~~~^~~~~~~~~~~
circle_selection.cpp:71:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
71 | scanf("%lld %lld %lld", &x, &y, &r ) ;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
256 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 |
288 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
512 KB |
Output is correct |
17 |
Correct |
2 ms |
512 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
6 ms |
1280 KB |
Output is correct |
20 |
Correct |
6 ms |
1280 KB |
Output is correct |
21 |
Correct |
8 ms |
1152 KB |
Output is correct |
22 |
Correct |
191 ms |
896 KB |
Output is correct |
23 |
Correct |
190 ms |
1016 KB |
Output is correct |
24 |
Correct |
198 ms |
896 KB |
Output is correct |
25 |
Correct |
186 ms |
896 KB |
Output is correct |
26 |
Correct |
199 ms |
900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
414 ms |
54756 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Runtime error |
123 ms |
19064 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1080 ms |
55952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
256 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 |
288 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
512 KB |
Output is correct |
17 |
Correct |
2 ms |
512 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
6 ms |
1280 KB |
Output is correct |
20 |
Correct |
6 ms |
1280 KB |
Output is correct |
21 |
Correct |
8 ms |
1152 KB |
Output is correct |
22 |
Correct |
191 ms |
896 KB |
Output is correct |
23 |
Correct |
190 ms |
1016 KB |
Output is correct |
24 |
Correct |
198 ms |
896 KB |
Output is correct |
25 |
Correct |
186 ms |
896 KB |
Output is correct |
26 |
Correct |
199 ms |
900 KB |
Output is correct |
27 |
Runtime error |
11 ms |
3456 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
256 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 |
288 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
512 KB |
Output is correct |
17 |
Correct |
2 ms |
512 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
6 ms |
1280 KB |
Output is correct |
20 |
Correct |
6 ms |
1280 KB |
Output is correct |
21 |
Correct |
8 ms |
1152 KB |
Output is correct |
22 |
Correct |
191 ms |
896 KB |
Output is correct |
23 |
Correct |
190 ms |
1016 KB |
Output is correct |
24 |
Correct |
198 ms |
896 KB |
Output is correct |
25 |
Correct |
186 ms |
896 KB |
Output is correct |
26 |
Correct |
199 ms |
900 KB |
Output is correct |
27 |
Runtime error |
414 ms |
54756 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |