//khodaya khodet komak kon
# include <bits/stdc++.h>
/*
// ordered_set
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;
typedef pair <int, pii> pip;
typedef pair <ll, ll> pll;
typedef pair <pll, pll> ppp;
# define A first
# define B second
# define endl '\n'
# define sep ' '
# define all(x) x.begin(), x.end()
# define kill(x) return cout << x << endl, 0
# define SZ(x) int(x.size())
# define lc id << 1
# define rc id << 1 | 1
# define InTheNameOfGod ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
const int xn = 3e5 + 10;
const int xm = - 20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int mod = 998244353;
const int base = 257;
int n, ans[xn];
ppp a[xn];
vector <int> adj[xn];
bool mark[xn];
int main(){
InTheNameOfGod;
cin >> n;
for (int i = 1; i <= n; ++ i){
cin >> a[i].B.A >> a[i].B.B >> a[i].A.A;
a[i].A.B = i;
a[i].A.A *= - 1;
}
for (int i = 1; i <= n; ++ i){
for (int j = 1; j <= n; ++ j){
ll x = abs(a[i].B.A - a[j].B.A);
ll y = abs(a[i].B.B - a[j].B.B);
ll z = - a[i].A.A - a[j].A.A;
if (x * x + y * y <= z * z)
adj[i].push_back(j);
}
}
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; ++ i){
if (mark[a[i].A.B])
continue;
for (int u : adj[a[i].A.B])
if (!mark[u])
mark[u] = true, ans[u] = a[i].A.B;
}
for (int i = 1; i <= n; ++ i)
cout << ans[i] << sep;
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7404 KB |
Output is correct |
2 |
Correct |
5 ms |
7404 KB |
Output is correct |
3 |
Correct |
5 ms |
7404 KB |
Output is correct |
4 |
Correct |
5 ms |
7404 KB |
Output is correct |
5 |
Correct |
5 ms |
7404 KB |
Output is correct |
6 |
Correct |
6 ms |
7404 KB |
Output is correct |
7 |
Correct |
5 ms |
7404 KB |
Output is correct |
8 |
Correct |
5 ms |
7404 KB |
Output is correct |
9 |
Correct |
5 ms |
7404 KB |
Output is correct |
10 |
Correct |
5 ms |
7404 KB |
Output is correct |
11 |
Correct |
6 ms |
7404 KB |
Output is correct |
12 |
Correct |
5 ms |
7412 KB |
Output is correct |
13 |
Correct |
5 ms |
7404 KB |
Output is correct |
14 |
Correct |
7 ms |
7404 KB |
Output is correct |
15 |
Correct |
5 ms |
7404 KB |
Output is correct |
16 |
Correct |
16 ms |
11244 KB |
Output is correct |
17 |
Correct |
16 ms |
10988 KB |
Output is correct |
18 |
Correct |
15 ms |
11500 KB |
Output is correct |
19 |
Correct |
193 ms |
122860 KB |
Output is correct |
20 |
Correct |
187 ms |
125804 KB |
Output is correct |
21 |
Correct |
263 ms |
82028 KB |
Output is correct |
22 |
Correct |
90 ms |
7916 KB |
Output is correct |
23 |
Correct |
93 ms |
7916 KB |
Output is correct |
24 |
Correct |
99 ms |
7916 KB |
Output is correct |
25 |
Correct |
107 ms |
7916 KB |
Output is correct |
26 |
Correct |
89 ms |
7916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2536 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7404 KB |
Output is correct |
2 |
Execution timed out |
3061 ms |
13944 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3066 ms |
25044 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7404 KB |
Output is correct |
2 |
Correct |
5 ms |
7404 KB |
Output is correct |
3 |
Correct |
5 ms |
7404 KB |
Output is correct |
4 |
Correct |
5 ms |
7404 KB |
Output is correct |
5 |
Correct |
5 ms |
7404 KB |
Output is correct |
6 |
Correct |
6 ms |
7404 KB |
Output is correct |
7 |
Correct |
5 ms |
7404 KB |
Output is correct |
8 |
Correct |
5 ms |
7404 KB |
Output is correct |
9 |
Correct |
5 ms |
7404 KB |
Output is correct |
10 |
Correct |
5 ms |
7404 KB |
Output is correct |
11 |
Correct |
6 ms |
7404 KB |
Output is correct |
12 |
Correct |
5 ms |
7412 KB |
Output is correct |
13 |
Correct |
5 ms |
7404 KB |
Output is correct |
14 |
Correct |
7 ms |
7404 KB |
Output is correct |
15 |
Correct |
5 ms |
7404 KB |
Output is correct |
16 |
Correct |
16 ms |
11244 KB |
Output is correct |
17 |
Correct |
16 ms |
10988 KB |
Output is correct |
18 |
Correct |
15 ms |
11500 KB |
Output is correct |
19 |
Correct |
193 ms |
122860 KB |
Output is correct |
20 |
Correct |
187 ms |
125804 KB |
Output is correct |
21 |
Correct |
263 ms |
82028 KB |
Output is correct |
22 |
Correct |
90 ms |
7916 KB |
Output is correct |
23 |
Correct |
93 ms |
7916 KB |
Output is correct |
24 |
Correct |
99 ms |
7916 KB |
Output is correct |
25 |
Correct |
107 ms |
7916 KB |
Output is correct |
26 |
Correct |
89 ms |
7916 KB |
Output is correct |
27 |
Correct |
969 ms |
339052 KB |
Output is correct |
28 |
Correct |
793 ms |
408484 KB |
Output is correct |
29 |
Correct |
833 ms |
394860 KB |
Output is correct |
30 |
Correct |
341 ms |
8428 KB |
Output is correct |
31 |
Correct |
347 ms |
8556 KB |
Output is correct |
32 |
Correct |
343 ms |
8556 KB |
Output is correct |
33 |
Runtime error |
2232 ms |
1048580 KB |
Execution killed with signal 9 |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7404 KB |
Output is correct |
2 |
Correct |
5 ms |
7404 KB |
Output is correct |
3 |
Correct |
5 ms |
7404 KB |
Output is correct |
4 |
Correct |
5 ms |
7404 KB |
Output is correct |
5 |
Correct |
5 ms |
7404 KB |
Output is correct |
6 |
Correct |
6 ms |
7404 KB |
Output is correct |
7 |
Correct |
5 ms |
7404 KB |
Output is correct |
8 |
Correct |
5 ms |
7404 KB |
Output is correct |
9 |
Correct |
5 ms |
7404 KB |
Output is correct |
10 |
Correct |
5 ms |
7404 KB |
Output is correct |
11 |
Correct |
6 ms |
7404 KB |
Output is correct |
12 |
Correct |
5 ms |
7412 KB |
Output is correct |
13 |
Correct |
5 ms |
7404 KB |
Output is correct |
14 |
Correct |
7 ms |
7404 KB |
Output is correct |
15 |
Correct |
5 ms |
7404 KB |
Output is correct |
16 |
Correct |
16 ms |
11244 KB |
Output is correct |
17 |
Correct |
16 ms |
10988 KB |
Output is correct |
18 |
Correct |
15 ms |
11500 KB |
Output is correct |
19 |
Correct |
193 ms |
122860 KB |
Output is correct |
20 |
Correct |
187 ms |
125804 KB |
Output is correct |
21 |
Correct |
263 ms |
82028 KB |
Output is correct |
22 |
Correct |
90 ms |
7916 KB |
Output is correct |
23 |
Correct |
93 ms |
7916 KB |
Output is correct |
24 |
Correct |
99 ms |
7916 KB |
Output is correct |
25 |
Correct |
107 ms |
7916 KB |
Output is correct |
26 |
Correct |
89 ms |
7916 KB |
Output is correct |
27 |
Runtime error |
2536 ms |
1048576 KB |
Execution killed with signal 9 |
28 |
Halted |
0 ms |
0 KB |
- |