Submission #625125

# Submission time Handle Problem Language Result Execution time Memory
625125 2022-08-09T12:14:58 Z jjang36524 Circle selection (APIO18_circle_selection) C++14
64 / 100
3000 ms 43000 KB
#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++)
			{
                int v=(j<<31)+k;
				if (!x.count(j * (1LL << 31) + k))
					continue;
				for (auto l = x[v].begin(); l != x[v].end(); l++)
				{
                    int le = *l;
					if (num[le])
						continue;


					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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 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 0 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 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 724 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 3 ms 724 KB Output is correct
22 Correct 14 ms 980 KB Output is correct
23 Correct 14 ms 1000 KB Output is correct
24 Correct 13 ms 980 KB Output is correct
25 Correct 17 ms 980 KB Output is correct
26 Correct 15 ms 1044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 181 ms 21244 KB Output is correct
2 Correct 158 ms 21252 KB Output is correct
3 Correct 168 ms 20604 KB Output is correct
4 Correct 152 ms 20164 KB Output is correct
5 Correct 495 ms 20928 KB Output is correct
6 Correct 811 ms 28300 KB Output is correct
7 Correct 470 ms 21972 KB Output is correct
8 Correct 544 ms 23264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 415 ms 14812 KB Output is correct
3 Correct 2005 ms 43000 KB Output is correct
4 Correct 1902 ms 42964 KB Output is correct
5 Correct 1282 ms 38752 KB Output is correct
6 Correct 495 ms 19384 KB Output is correct
7 Correct 193 ms 10340 KB Output is correct
8 Correct 39 ms 2464 KB Output is correct
9 Correct 1729 ms 42244 KB Output is correct
10 Correct 1145 ms 36432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2199 ms 42936 KB Output is correct
2 Execution timed out 3102 ms 38376 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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 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 0 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 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 724 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 3 ms 724 KB Output is correct
22 Correct 14 ms 980 KB Output is correct
23 Correct 14 ms 1000 KB Output is correct
24 Correct 13 ms 980 KB Output is correct
25 Correct 17 ms 980 KB Output is correct
26 Correct 15 ms 1044 KB Output is correct
27 Correct 6 ms 984 KB Output is correct
28 Correct 6 ms 1080 KB Output is correct
29 Correct 5 ms 1032 KB Output is correct
30 Correct 29 ms 1716 KB Output is correct
31 Correct 30 ms 1712 KB Output is correct
32 Correct 31 ms 1704 KB Output is correct
33 Correct 62 ms 7328 KB Output is correct
34 Correct 49 ms 7492 KB Output is correct
35 Correct 59 ms 7004 KB Output is correct
36 Correct 429 ms 14728 KB Output is correct
37 Correct 450 ms 14884 KB Output is correct
38 Correct 401 ms 14760 KB Output is correct
39 Correct 368 ms 14404 KB Output is correct
40 Correct 389 ms 14488 KB Output is correct
41 Correct 382 ms 14528 KB Output is correct
42 Correct 215 ms 11112 KB Output is correct
43 Correct 411 ms 14584 KB Output is correct
44 Correct 405 ms 14584 KB Output is correct
45 Correct 366 ms 14540 KB Output is correct
46 Correct 396 ms 14580 KB Output is correct
47 Correct 370 ms 14588 KB Output is correct
48 Correct 383 ms 14596 KB Output is correct
49 Correct 379 ms 14584 KB Output is correct
50 Correct 442 ms 14620 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 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 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 0 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 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 724 KB Output is correct
20 Correct 4 ms 724 KB Output is correct
21 Correct 3 ms 724 KB Output is correct
22 Correct 14 ms 980 KB Output is correct
23 Correct 14 ms 1000 KB Output is correct
24 Correct 13 ms 980 KB Output is correct
25 Correct 17 ms 980 KB Output is correct
26 Correct 15 ms 1044 KB Output is correct
27 Correct 181 ms 21244 KB Output is correct
28 Correct 158 ms 21252 KB Output is correct
29 Correct 168 ms 20604 KB Output is correct
30 Correct 152 ms 20164 KB Output is correct
31 Correct 495 ms 20928 KB Output is correct
32 Correct 811 ms 28300 KB Output is correct
33 Correct 470 ms 21972 KB Output is correct
34 Correct 544 ms 23264 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 415 ms 14812 KB Output is correct
37 Correct 2005 ms 43000 KB Output is correct
38 Correct 1902 ms 42964 KB Output is correct
39 Correct 1282 ms 38752 KB Output is correct
40 Correct 495 ms 19384 KB Output is correct
41 Correct 193 ms 10340 KB Output is correct
42 Correct 39 ms 2464 KB Output is correct
43 Correct 1729 ms 42244 KB Output is correct
44 Correct 1145 ms 36432 KB Output is correct
45 Correct 2199 ms 42936 KB Output is correct
46 Execution timed out 3102 ms 38376 KB Time limit exceeded
47 Halted 0 ms 0 KB -