# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62947 | win11905 | Unija (COCI17_unija) | C++11 | 653 ms | 66560 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 long long long
#define pii pair<int, int>
#define x first
#define y second
const int N = 1e6+5;
int n;
vector<pii> V, A;
int main() {
scanf("%d", &n);
for(int i = 0, a, b; i < n; ++i) {
scanf("%d %d", &a, &b);
V.emplace_back(a >> 1, b >> 1);
}
sort(V.begin(), V.end(), [&](const pii &a, const pii &b) {
if(a.x == b.x) return a.y < b.y;
return a.x > b.x;
});
A.emplace_back(V[0]);
for(int i = 1; i < n; ++i) {
if(V[i].y > A.back().y) A.emplace_back(V[i]);
}
int pv = 0;
long sum = 0;
for(auto x : A) {
sum += 1ll * x.x * (x.y - pv);
pv = x.y;
}
printf("%lld\n", sum << 2);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |