# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713824 | LittleOrange | Highway Tolls (IOI18_highway) | C++17 | 0 ms | 0 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 ll = long long;
struct line{
ll to,i;
};
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
int M = U.size();
vector<vector<line>> con(N);
for(ll i = 0;i<M;i++){
con[U[i]].push_back({V[i],i});
con[V[i]].push_back({U[i],i});
}
if (M == N-1){
vector<int> w(M,0);
ll total_dis = ask(w)/A;
auto doask = [&](){
return (ask(w)-total_dis*a)/(b-a);
};
if (N<=100){
vector<int> ans;
for(int i = 0;i<N;i++){
for(line l : con[i]){
w[l.i] = 1;
}
if (doask()==1) ans.push_back(i+1);
for(line l : con[i]){
w[l.i] = 0;
}
}
answer(ans[0],ans[1]);
}
}
}