#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <vector>
#define int long long
using namespace std;
unordered_map<int, vector<int>>x;
int po[300100][2];
vector<pair<int, int>>so;
int pre[300100];
int num[300100];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N;
cin >> N;
int i;
for (i = 0; i < N; i++)
{
int a, b, c;
cin >> a >> b >> c;
a += 1LL << 30;
b += 1LL << 30;
pre[i] = c;
so.push_back({ -c,i });
po[i][0] = a;
po[i][1] = b;
}
sort(so.begin(), so.end());
int gr = 30;
for (i = 0; i < N; i++)
{
x[po[i][0] / (1LL << gr) * (1LL << 31) + po[i][1] / (1LL << gr)].push_back(i);
}
for (i = 0; i < N; i++)
{
if (num[so[i].second])
continue;
while ((1LL << gr) >= -so[i].first * 2)
{
gr--;
x.clear();
int i;
for (i = 0; i < N; i++)
{
if (num[i])
continue;
x[po[i][0] / (1LL << gr) * (1LL << 31) + po[i][1] / (1LL << gr)].push_back(i);
}
}
int cuuu = so[i].second;
int xx = po[cuuu][0] / (1LL << gr);
int y = po[cuuu][1] / (1LL << gr);
int j, k;
for (j = xx - 2; j <= xx + 2; j++)
{
for (k = y - 2; k <= y + 2; k++)
{
if (!x.count(j * (1LL << 31) + k))
continue;
for (auto l = x[j * (1LL << 31) + k].begin(); l != x[j * (1LL << 31) + k].end(); l++)
{
if (num[*l])
continue;
int le = *l;
int xxx = (po[cuuu][0] - po[le][0]);
int yyy = (po[cuuu][1] - po[le][1]);
int rrr = (-so[i].first + pre[le]);
if (xxx * xxx + yyy * yyy <= rrr * rrr)
{
num[le] = cuuu + 1;
}
}
}
}
}
for (i = 0; i < N; i++)
{
cout << num[i] << ' ';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
356 KB |
Output is correct |
18 |
Correct |
1 ms |
404 KB |
Output is correct |
19 |
Correct |
3 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
860 KB |
Output is correct |
21 |
Correct |
4 ms |
852 KB |
Output is correct |
22 |
Correct |
17 ms |
1088 KB |
Output is correct |
23 |
Correct |
16 ms |
1140 KB |
Output is correct |
24 |
Correct |
14 ms |
1104 KB |
Output is correct |
25 |
Correct |
16 ms |
1168 KB |
Output is correct |
26 |
Correct |
14 ms |
1120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
149 ms |
27952 KB |
Output is correct |
2 |
Correct |
171 ms |
27996 KB |
Output is correct |
3 |
Correct |
162 ms |
27220 KB |
Output is correct |
4 |
Correct |
135 ms |
26984 KB |
Output is correct |
5 |
Correct |
453 ms |
25680 KB |
Output is correct |
6 |
Correct |
766 ms |
32932 KB |
Output is correct |
7 |
Correct |
454 ms |
26612 KB |
Output is correct |
8 |
Correct |
522 ms |
27952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
343 ms |
17648 KB |
Output is correct |
3 |
Correct |
1840 ms |
51020 KB |
Output is correct |
4 |
Correct |
1818 ms |
51028 KB |
Output is correct |
5 |
Correct |
1249 ms |
46624 KB |
Output is correct |
6 |
Correct |
460 ms |
23720 KB |
Output is correct |
7 |
Correct |
222 ms |
12532 KB |
Output is correct |
8 |
Correct |
39 ms |
2904 KB |
Output is correct |
9 |
Correct |
1625 ms |
50200 KB |
Output is correct |
10 |
Correct |
1101 ms |
45100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2059 ms |
50872 KB |
Output is correct |
2 |
Execution timed out |
3046 ms |
45596 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
356 KB |
Output is correct |
18 |
Correct |
1 ms |
404 KB |
Output is correct |
19 |
Correct |
3 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
860 KB |
Output is correct |
21 |
Correct |
4 ms |
852 KB |
Output is correct |
22 |
Correct |
17 ms |
1088 KB |
Output is correct |
23 |
Correct |
16 ms |
1140 KB |
Output is correct |
24 |
Correct |
14 ms |
1104 KB |
Output is correct |
25 |
Correct |
16 ms |
1168 KB |
Output is correct |
26 |
Correct |
14 ms |
1120 KB |
Output is correct |
27 |
Correct |
6 ms |
1292 KB |
Output is correct |
28 |
Correct |
6 ms |
1340 KB |
Output is correct |
29 |
Correct |
6 ms |
1288 KB |
Output is correct |
30 |
Correct |
31 ms |
1964 KB |
Output is correct |
31 |
Correct |
28 ms |
1976 KB |
Output is correct |
32 |
Correct |
29 ms |
1912 KB |
Output is correct |
33 |
Correct |
51 ms |
10448 KB |
Output is correct |
34 |
Correct |
50 ms |
10440 KB |
Output is correct |
35 |
Correct |
62 ms |
10012 KB |
Output is correct |
36 |
Correct |
374 ms |
17304 KB |
Output is correct |
37 |
Correct |
484 ms |
17528 KB |
Output is correct |
38 |
Correct |
378 ms |
17436 KB |
Output is correct |
39 |
Correct |
368 ms |
15552 KB |
Output is correct |
40 |
Correct |
361 ms |
15484 KB |
Output is correct |
41 |
Correct |
362 ms |
15456 KB |
Output is correct |
42 |
Correct |
208 ms |
12736 KB |
Output is correct |
43 |
Correct |
353 ms |
17276 KB |
Output is correct |
44 |
Correct |
336 ms |
17204 KB |
Output is correct |
45 |
Correct |
345 ms |
17284 KB |
Output is correct |
46 |
Correct |
348 ms |
17276 KB |
Output is correct |
47 |
Correct |
353 ms |
17240 KB |
Output is correct |
48 |
Correct |
347 ms |
17188 KB |
Output is correct |
49 |
Correct |
360 ms |
17212 KB |
Output is correct |
50 |
Correct |
369 ms |
17212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
356 KB |
Output is correct |
18 |
Correct |
1 ms |
404 KB |
Output is correct |
19 |
Correct |
3 ms |
860 KB |
Output is correct |
20 |
Correct |
4 ms |
860 KB |
Output is correct |
21 |
Correct |
4 ms |
852 KB |
Output is correct |
22 |
Correct |
17 ms |
1088 KB |
Output is correct |
23 |
Correct |
16 ms |
1140 KB |
Output is correct |
24 |
Correct |
14 ms |
1104 KB |
Output is correct |
25 |
Correct |
16 ms |
1168 KB |
Output is correct |
26 |
Correct |
14 ms |
1120 KB |
Output is correct |
27 |
Correct |
149 ms |
27952 KB |
Output is correct |
28 |
Correct |
171 ms |
27996 KB |
Output is correct |
29 |
Correct |
162 ms |
27220 KB |
Output is correct |
30 |
Correct |
135 ms |
26984 KB |
Output is correct |
31 |
Correct |
453 ms |
25680 KB |
Output is correct |
32 |
Correct |
766 ms |
32932 KB |
Output is correct |
33 |
Correct |
454 ms |
26612 KB |
Output is correct |
34 |
Correct |
522 ms |
27952 KB |
Output is correct |
35 |
Correct |
1 ms |
340 KB |
Output is correct |
36 |
Correct |
343 ms |
17648 KB |
Output is correct |
37 |
Correct |
1840 ms |
51020 KB |
Output is correct |
38 |
Correct |
1818 ms |
51028 KB |
Output is correct |
39 |
Correct |
1249 ms |
46624 KB |
Output is correct |
40 |
Correct |
460 ms |
23720 KB |
Output is correct |
41 |
Correct |
222 ms |
12532 KB |
Output is correct |
42 |
Correct |
39 ms |
2904 KB |
Output is correct |
43 |
Correct |
1625 ms |
50200 KB |
Output is correct |
44 |
Correct |
1101 ms |
45100 KB |
Output is correct |
45 |
Correct |
2059 ms |
50872 KB |
Output is correct |
46 |
Execution timed out |
3046 ms |
45596 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |