Submission #625123

# Submission time Handle Problem Language Result Execution time Memory
625123 2022-08-09T12:12:03 Z jjang36524 Circle selection (APIO18_circle_selection) C++14
64 / 100
3000 ms 40684 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;
signed pre[300100];
signed num[300100];
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	signed N;
	cin >> N;
	signed 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 0 ms 340 KB Output is correct
4 Correct 0 ms 212 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 352 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 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 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 3 ms 668 KB Output is correct
22 Correct 14 ms 980 KB Output is correct
23 Correct 16 ms 960 KB Output is correct
24 Correct 14 ms 980 KB Output is correct
25 Correct 18 ms 988 KB Output is correct
26 Correct 14 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 18840 KB Output is correct
2 Correct 149 ms 18868 KB Output is correct
3 Correct 154 ms 18204 KB Output is correct
4 Correct 141 ms 17840 KB Output is correct
5 Correct 466 ms 18696 KB Output is correct
6 Correct 809 ms 26124 KB Output is correct
7 Correct 455 ms 19504 KB Output is correct
8 Correct 518 ms 21096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 341 ms 14048 KB Output is correct
3 Correct 1896 ms 40684 KB Output is correct
4 Correct 1873 ms 40572 KB Output is correct
5 Correct 1339 ms 36460 KB Output is correct
6 Correct 566 ms 18144 KB Output is correct
7 Correct 195 ms 9620 KB Output is correct
8 Correct 37 ms 2228 KB Output is correct
9 Correct 1705 ms 39736 KB Output is correct
10 Correct 1158 ms 34080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2212 ms 40640 KB Output is correct
2 Execution timed out 3079 ms 37308 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 212 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 352 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 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 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 3 ms 668 KB Output is correct
22 Correct 14 ms 980 KB Output is correct
23 Correct 16 ms 960 KB Output is correct
24 Correct 14 ms 980 KB Output is correct
25 Correct 18 ms 988 KB Output is correct
26 Correct 14 ms 1004 KB Output is correct
27 Correct 7 ms 908 KB Output is correct
28 Correct 6 ms 952 KB Output is correct
29 Correct 7 ms 904 KB Output is correct
30 Correct 28 ms 1584 KB Output is correct
31 Correct 29 ms 1640 KB Output is correct
32 Correct 29 ms 1660 KB Output is correct
33 Correct 48 ms 6720 KB Output is correct
34 Correct 46 ms 6556 KB Output is correct
35 Correct 60 ms 6236 KB Output is correct
36 Correct 488 ms 14036 KB Output is correct
37 Correct 458 ms 14140 KB Output is correct
38 Correct 424 ms 14028 KB Output is correct
39 Correct 376 ms 13528 KB Output is correct
40 Correct 387 ms 13612 KB Output is correct
41 Correct 400 ms 13728 KB Output is correct
42 Correct 215 ms 10312 KB Output is correct
43 Correct 426 ms 13876 KB Output is correct
44 Correct 366 ms 13804 KB Output is correct
45 Correct 433 ms 13796 KB Output is correct
46 Correct 364 ms 13792 KB Output is correct
47 Correct 356 ms 13784 KB Output is correct
48 Correct 344 ms 13836 KB Output is correct
49 Correct 416 ms 13772 KB Output is correct
50 Correct 381 ms 13816 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 212 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 352 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 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 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 3 ms 668 KB Output is correct
22 Correct 14 ms 980 KB Output is correct
23 Correct 16 ms 960 KB Output is correct
24 Correct 14 ms 980 KB Output is correct
25 Correct 18 ms 988 KB Output is correct
26 Correct 14 ms 1004 KB Output is correct
27 Correct 143 ms 18840 KB Output is correct
28 Correct 149 ms 18868 KB Output is correct
29 Correct 154 ms 18204 KB Output is correct
30 Correct 141 ms 17840 KB Output is correct
31 Correct 466 ms 18696 KB Output is correct
32 Correct 809 ms 26124 KB Output is correct
33 Correct 455 ms 19504 KB Output is correct
34 Correct 518 ms 21096 KB Output is correct
35 Correct 0 ms 340 KB Output is correct
36 Correct 341 ms 14048 KB Output is correct
37 Correct 1896 ms 40684 KB Output is correct
38 Correct 1873 ms 40572 KB Output is correct
39 Correct 1339 ms 36460 KB Output is correct
40 Correct 566 ms 18144 KB Output is correct
41 Correct 195 ms 9620 KB Output is correct
42 Correct 37 ms 2228 KB Output is correct
43 Correct 1705 ms 39736 KB Output is correct
44 Correct 1158 ms 34080 KB Output is correct
45 Correct 2212 ms 40640 KB Output is correct
46 Execution timed out 3079 ms 37308 KB Time limit exceeded
47 Halted 0 ms 0 KB -