-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathround_Gq2.cpp
More file actions
101 lines (93 loc) · 2.14 KB
/
Copy pathround_Gq2.cpp
File metadata and controls
101 lines (93 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <bits/stdc++.h>
using namespace std;
void swap(double* xp, double* yp)
{
double temp = *xp;
*xp = *yp;
*yp = temp;
}
void bSort(double arr[], int n)
{
int i, j;
for (i = 0; i < n - 1; i++)
for (j = 0; j < n - i - 1; j++)
if (arr[j] > arr[j + 1])
swap(&arr[j], &arr[j + 1]);
}
int main()
{
int samples;
int out = 1;
cin >> samples;
while (samples--)
{
int rs, rh;
cin >> rs >> rh;
double real_radius = rs + rh;
int countx = 0;
int countz = 0;
int n, m;
cin >> n;
int arrx[n][2];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> arrx[i][j];
}
}
double distX[n];
for (int i = 0; i < n; i++)
{
distX[i] = sqrt(arrx[i][0] * arrx[i][0] + arrx[i][1] * arrx[i][1]);
/*if (distX[i] - real_radius <= 0)
{
countx++;
}*/
}
cin >> m;
int arrz[m][2];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> arrz[i][j];
}
}
double distZ[m];
for (int i = 0; i < m; i++)
{
distZ[i] = sqrt(arrz[i][0] * arrz[i][0] + arrz[i][1] * arrz[i][1]);
/*if (distZ[i] - real_radius <= 0)
{
countz++;
}*/
}
bSort(distX, n);
bSort(distZ, m);
if (n != 0 && m != 0)
{
if (distX[0] > distZ[0])
{
int i = 0;
while (distX[i] < distZ[i])
{
countx++;
i++;
}
}
if (distZ[0] > distX[0])
{
int i = 0;
while (distX[i] > distZ[i])
{
countz++;
i++;
}
}
}
cout << "Case #" << out << ": " << countx << " " << countz << endl;
out++;
}
return 0;
}