# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
453395 | nonsensenonsense1 | Palembang Bridges (APIO15_bridge) | C++17 | 56 ms | 3488 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 <cstdio>
#include <vector>
const int N = 1000000000;
int k, n;
std::vector<std::pair<int, int> > a;
long long test2(int x)
{
long long s = 0;
for (int i = 0; i < (int)a.size(); ++i) s += std::max(a[i].first - x, 0) + std::max(x - a[i].second, 0);
return s;
}
long long test1()
{
int l = 0, r = N, opt;
while (l <= r) {
int m = l + r >> 1;
if (test2(m) <= test2(m + 1)) {
opt = m;
r = m - 1;
}
else l = m + 1;
}
return test2(opt);
}
int main()
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... |