#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i ,a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)
using namespace std;
#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().times_since_epoch().count())
#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
namespace solver {
int n;
vector<int> vis, x, y, r;
void init_(int _n) {
n = _n;
x.assign(n + 1, 0);
y.assign(n + 1, 0);
r.assign(n + 1, 0);
vis.assign(n + 1, 0);
}
bool cmp(int a, int b) {
if(r[a] != r[b]) return r[a] > r[b];
else return a < b;
}
bool comp(int a, int b) {
int xx = x[a] - x[b];
int yy = y[a] - y[b];
int ans = xx * xx + yy * yy;
int rr = (r[a] + r[b]) * (r[a] + r[b]);
return ans <= rr;
}
void solve() {
vector<int> ord;
rep(i, 1, n) ord.push_back(i);
sort(all(ord), cmp);
for(auto i : ord) {
if(vis[i]) continue;
vis[i] = i;
rep(j, 1, n) if(!vis[j] && comp(i, j)) vis[j] = i;
}
rep(i, 1, n) cout << vis[i] << " \n"[i == n];
}
};
using namespace solver;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int n; cin >> n;
init_(n);
rep(i, 1, n) cin >> x[i] >> y[i] >> r[i];
solve();
return 0;
}
Compilation message
circle_selection.cpp:4: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
4 | #pragma loop-opt(on)
|
circle_selection.cpp:23:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
23 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
| ^~~~
circle_selection.cpp:23:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
23 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
316 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
312 KB |
Output is correct |
16 |
Correct |
1 ms |
328 KB |
Output is correct |
17 |
Correct |
1 ms |
304 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
4 ms |
716 KB |
Output is correct |
20 |
Correct |
4 ms |
716 KB |
Output is correct |
21 |
Correct |
4 ms |
716 KB |
Output is correct |
22 |
Correct |
76 ms |
712 KB |
Output is correct |
23 |
Correct |
77 ms |
684 KB |
Output is correct |
24 |
Correct |
77 ms |
692 KB |
Output is correct |
25 |
Correct |
90 ms |
684 KB |
Output is correct |
26 |
Correct |
89 ms |
688 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
192 ms |
20944 KB |
Output is correct |
2 |
Correct |
193 ms |
20944 KB |
Output is correct |
3 |
Correct |
199 ms |
20648 KB |
Output is correct |
4 |
Correct |
189 ms |
20940 KB |
Output is correct |
5 |
Execution timed out |
3082 ms |
18492 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
3028 ms |
7288 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3064 ms |
21844 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 |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
316 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
312 KB |
Output is correct |
16 |
Correct |
1 ms |
328 KB |
Output is correct |
17 |
Correct |
1 ms |
304 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
4 ms |
716 KB |
Output is correct |
20 |
Correct |
4 ms |
716 KB |
Output is correct |
21 |
Correct |
4 ms |
716 KB |
Output is correct |
22 |
Correct |
76 ms |
712 KB |
Output is correct |
23 |
Correct |
77 ms |
684 KB |
Output is correct |
24 |
Correct |
77 ms |
692 KB |
Output is correct |
25 |
Correct |
90 ms |
684 KB |
Output is correct |
26 |
Correct |
89 ms |
688 KB |
Output is correct |
27 |
Correct |
7 ms |
1100 KB |
Output is correct |
28 |
Correct |
7 ms |
1092 KB |
Output is correct |
29 |
Correct |
7 ms |
1092 KB |
Output is correct |
30 |
Correct |
329 ms |
1100 KB |
Output is correct |
31 |
Correct |
328 ms |
1100 KB |
Output is correct |
32 |
Correct |
330 ms |
1112 KB |
Output is correct |
33 |
Correct |
65 ms |
8000 KB |
Output is correct |
34 |
Correct |
65 ms |
8000 KB |
Output is correct |
35 |
Correct |
75 ms |
7916 KB |
Output is correct |
36 |
Execution timed out |
3081 ms |
7108 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 |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
316 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
312 KB |
Output is correct |
16 |
Correct |
1 ms |
328 KB |
Output is correct |
17 |
Correct |
1 ms |
304 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
4 ms |
716 KB |
Output is correct |
20 |
Correct |
4 ms |
716 KB |
Output is correct |
21 |
Correct |
4 ms |
716 KB |
Output is correct |
22 |
Correct |
76 ms |
712 KB |
Output is correct |
23 |
Correct |
77 ms |
684 KB |
Output is correct |
24 |
Correct |
77 ms |
692 KB |
Output is correct |
25 |
Correct |
90 ms |
684 KB |
Output is correct |
26 |
Correct |
89 ms |
688 KB |
Output is correct |
27 |
Correct |
192 ms |
20944 KB |
Output is correct |
28 |
Correct |
193 ms |
20944 KB |
Output is correct |
29 |
Correct |
199 ms |
20648 KB |
Output is correct |
30 |
Correct |
189 ms |
20940 KB |
Output is correct |
31 |
Execution timed out |
3082 ms |
18492 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |