# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222816 | rama_pang | Highway Tolls (IOI18_highway) | C++14 | 222 ms | 9292 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 "highway.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
int M = U.size(), E = -1;
lint base_cost_light = ask(vector<int>(M, 0));
lint base_cost_heavy = (base_cost_light / A) * B;
vector<int> heavy;
vector<int> edge_list[2]; // edges that are in the BFS tree of U[E] and V[E]
{ // Binary Search to find an edge E which is in the shortest path from S to T if unweighted
heavy.assign(M, 0);
int lo = 0, hi = M - 1;
while (lo < hi) {
int mid = (lo + hi) / 2;
for (int i = 0; i < M; i++) heavy[i] = i <= mid;
if (ask(heavy) != base_cost_light) { // one of the heavy edges we set is in the unweighted shortest path
hi = mid;
} else {
lo = mid + 1;
}
}
E = hi;
}
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... |