Submission #404793

# Submission time Handle Problem Language Result Execution time Memory
404793 2021-05-15T02:37:47 Z jjang36524 Circle selection (APIO18_circle_selection) C++14
64 / 100
3000 ms 51084 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);
	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 xx = po[so[i].second][0] / (1LL << gr);
		int y = po[so[i].second][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;
				int l;
				for (l = 0; l < x[j*(1LL<<31)+ k].size(); l++)
				{
					int le = x[j * (1LL << 31)+ k][l];
					if (num[le])
						continue;
					int xxx = (po[so[i].second][0] - po[le][0]);
					int yyy = (po[so[i].second][1] - po[le][1]);
					int rrr = (-so[i].first + pre[le]);
					if (xxx*xxx+yyy*yyy<=rrr*rrr)
					{
						num[le] = so[i].second+1;
					}
				}
			}
		}
	}
	for (i = 0; i < N; i++)
	{
		cout << num[i] << ' ';
	}
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:62:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for (l = 0; l < x[j*(1LL<<31)+ k].size(); l++)
      |                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 716 KB Output is correct
20 Correct 4 ms 720 KB Output is correct
21 Correct 6 ms 660 KB Output is correct
22 Correct 20 ms 972 KB Output is correct
23 Correct 19 ms 968 KB Output is correct
24 Correct 19 ms 1044 KB Output is correct
25 Correct 20 ms 972 KB Output is correct
26 Correct 21 ms 1036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 21192 KB Output is correct
2 Correct 222 ms 21192 KB Output is correct
3 Correct 213 ms 20568 KB Output is correct
4 Correct 186 ms 20132 KB Output is correct
5 Correct 644 ms 20936 KB Output is correct
6 Correct 1006 ms 28524 KB Output is correct
7 Correct 641 ms 22044 KB Output is correct
8 Correct 700 ms 23464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 454 ms 14796 KB Output is correct
3 Correct 2386 ms 42988 KB Output is correct
4 Correct 2430 ms 51084 KB Output is correct
5 Correct 1671 ms 46616 KB Output is correct
6 Correct 607 ms 23692 KB Output is correct
7 Correct 259 ms 12652 KB Output is correct
8 Correct 56 ms 2944 KB Output is correct
9 Correct 2114 ms 50268 KB Output is correct
10 Correct 1448 ms 44864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2692 ms 42928 KB Output is correct
2 Execution timed out 3097 ms 38364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 716 KB Output is correct
20 Correct 4 ms 720 KB Output is correct
21 Correct 6 ms 660 KB Output is correct
22 Correct 20 ms 972 KB Output is correct
23 Correct 19 ms 968 KB Output is correct
24 Correct 19 ms 1044 KB Output is correct
25 Correct 20 ms 972 KB Output is correct
26 Correct 21 ms 1036 KB Output is correct
27 Correct 8 ms 1008 KB Output is correct
28 Correct 9 ms 1072 KB Output is correct
29 Correct 7 ms 1024 KB Output is correct
30 Correct 36 ms 1628 KB Output is correct
31 Correct 40 ms 1712 KB Output is correct
32 Correct 37 ms 1684 KB Output is correct
33 Correct 68 ms 7348 KB Output is correct
34 Correct 75 ms 7384 KB Output is correct
35 Correct 81 ms 7056 KB Output is correct
36 Correct 507 ms 14808 KB Output is correct
37 Correct 641 ms 14880 KB Output is correct
38 Correct 486 ms 14760 KB Output is correct
39 Correct 602 ms 14296 KB Output is correct
40 Correct 578 ms 14400 KB Output is correct
41 Correct 571 ms 14392 KB Output is correct
42 Correct 303 ms 11056 KB Output is correct
43 Correct 512 ms 14716 KB Output is correct
44 Correct 442 ms 14612 KB Output is correct
45 Correct 458 ms 14788 KB Output is correct
46 Correct 533 ms 14568 KB Output is correct
47 Correct 463 ms 14636 KB Output is correct
48 Correct 459 ms 14620 KB Output is correct
49 Correct 590 ms 14568 KB Output is correct
50 Correct 490 ms 14708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 716 KB Output is correct
20 Correct 4 ms 720 KB Output is correct
21 Correct 6 ms 660 KB Output is correct
22 Correct 20 ms 972 KB Output is correct
23 Correct 19 ms 968 KB Output is correct
24 Correct 19 ms 1044 KB Output is correct
25 Correct 20 ms 972 KB Output is correct
26 Correct 21 ms 1036 KB Output is correct
27 Correct 197 ms 21192 KB Output is correct
28 Correct 222 ms 21192 KB Output is correct
29 Correct 213 ms 20568 KB Output is correct
30 Correct 186 ms 20132 KB Output is correct
31 Correct 644 ms 20936 KB Output is correct
32 Correct 1006 ms 28524 KB Output is correct
33 Correct 641 ms 22044 KB Output is correct
34 Correct 700 ms 23464 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 454 ms 14796 KB Output is correct
37 Correct 2386 ms 42988 KB Output is correct
38 Correct 2430 ms 51084 KB Output is correct
39 Correct 1671 ms 46616 KB Output is correct
40 Correct 607 ms 23692 KB Output is correct
41 Correct 259 ms 12652 KB Output is correct
42 Correct 56 ms 2944 KB Output is correct
43 Correct 2114 ms 50268 KB Output is correct
44 Correct 1448 ms 44864 KB Output is correct
45 Correct 2692 ms 42928 KB Output is correct
46 Execution timed out 3097 ms 38364 KB Time limit exceeded
47 Halted 0 ms 0 KB -