Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #4549381

Source Code Expand

Copy
```#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int n;
vector<pair<pair<int, int>, int>> v;

int solve();
bool ch(int x, int y);

int main() {
cin >> n;
for(int t = 0; t < 2; ++t)
for(int i = 0; i < n; ++i) {
int x, y;
cin >> x >> y;
v.push_back({{x, y}, t});
}
sort(v.begin(), v.end());
cout << solve() << endl;
return 0;
}

int solve() {
vector<int> now;
int ans = 0;
for(int i = 0; i < 2 * n; ++i) {
if(v[i].se == 0)
now.push_back(v[i].fi.se);
else {
sort(now.begin(), now.end());
auto it =
lower_bound(now.begin(), now.end(), v[i].fi.se);
if(it != now.begin()) {
++ans;
now.erase(--it);
}
}
}
return ans;
}```

Submission Info

Submission Time 2019-03-11 16:37:02+0900 C - 2D Plane 2N Points m_tsubasa C++14 (GCC 5.4.1) 400 799 Byte AC 1 ms 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_0, example_1, example_2, example_3, example_4
All 400 / 400 example_0, example_1, example_2, example_3, example_4, line_0, line_1, line_2, line_3, maxrand_0, maxrand_1, maxrand_2, maxrand_3, maxrand_4, rand_0, rand_1, rand_2
Case Name Status Exec Time Memory
example_0 1 ms 256 KB
example_1 1 ms 256 KB
example_2 1 ms 256 KB
example_3 1 ms 256 KB
example_4 1 ms 256 KB
line_0 1 ms 256 KB
line_1 1 ms 256 KB
line_2 1 ms 256 KB
line_3 1 ms 256 KB
maxrand_0 1 ms 256 KB
maxrand_1 1 ms 256 KB
maxrand_2 1 ms 256 KB
maxrand_3 1 ms 256 KB
maxrand_4 1 ms 256 KB
rand_0 1 ms 256 KB
rand_1 1 ms 256 KB
rand_2 1 ms 256 KB