# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236911 | DS007 | Coin Collecting (JOI19_ho_t4) | C++14 | 100 ms | 14308 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int solveTestCase() {
int n;
cin >> n;
vector<pair<int, int>> up, down, up_, down_;
for (int i = 0; i < n * 2; i++) {
int x, y;
cin >> x >> y;
if (y <= 1)
down.emplace_back(x, y);
else
up.emplace_back(x, y);
}
sort(up.begin(), up.end());
sort(down.begin(), down.end());
int ans = 0;
for (int i = 1, p1 = 0, p2 = 0, i1 = 1, i2 = 1; i <= n; i++) {
while (p1 < up.size() && up[p1].first <= (i == n ? 1e9 : i))
up_.push_back(up[p1++]);
while (p2 < down.size() && down[p2].first <= (i == n ? 1e9 : i))
down_.push_back(down[p2++]);
while (i1 <= i && !up_.empty())
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |