| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 903567 | 12345678 | Highway Tolls (IOI18_highway) | C++17 | 87 ms | 9960 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;
#define ll long long
const int nx=1e5+5;
int id[nx], t, vs[nx], res[nx];
vector<pair<int, int>> d[nx];
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
vector<int> qs(N-1);
for (int i=0; i<U.size(); i++) d[U[i]].push_back({V[i], i}), d[V[i]].push_back({U[i], i});
ll length=ask(qs)/A;
queue<int> q;
q.push(0);
vs[0]=1;
while (!q.empty())
{
int u=q.front();
q.pop();
for (auto [v, idx]:d[u]) if (!vs[v]) res[t]=v, id[t++]=idx, vs[v]=1, q.push(v);
}
int l=0, r=N-1;
while (l<r)
{
int md=(l+r)/2;
for (int i=0; i<N-1; i++) qs[i]=0;
for (int i=0; i<=md; i++) qs[id[i]]=1;
if (ask(qs)/B==length) r=md;
else l=md+1;
}
answer(0, res[l]);
}
/*
4 3 1 2 0 3
0 1
0 2
1 3
*/
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... | ||||
