Skip to content

Commit 7015999

Browse files
committed
Add 29640.cpp
1 parent 5d71094 commit 7015999

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

29xxx/29640.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include <algorithm>
2+
#include <cmath>
3+
#include <iostream>
4+
#include <vector>
5+
using namespace std;
6+
7+
inline int calc(const vector<double> &v, double x) {
8+
int ret = 0;
9+
for (int i=0; i<v.size(); i++) {
10+
if (v[i] < x) ret++;
11+
}
12+
return ret;
13+
}
14+
15+
void solve(void) {
16+
int n; cin >> n;
17+
18+
int a = 0, b = 0;
19+
while (n--) {
20+
int m, k; cin >> m >> k;
21+
vector<double> p, q;
22+
while (m--) {
23+
int x, y; cin >> x >> y;
24+
p.push_back(hypot(x, y));
25+
}
26+
while (k--) {
27+
int x, y; cin >> x >> y;
28+
q.push_back(hypot(x, y));
29+
}
30+
sort(p.begin(), p.end());
31+
sort(q.begin(), q.end());
32+
if (p[0] < q[0]) a += calc(p, q[0]);
33+
if (p[0] > q[0]) b += calc(q, p[0]);
34+
}
35+
cout << a << ":" << b;
36+
}
37+
38+
int main(void) {
39+
ios::sync_with_stdio(false);
40+
cin.tie(nullptr);
41+
42+
solve();
43+
return 0;
44+
}

0 commit comments

Comments
 (0)