# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
467231 | Leonardo_Paes | Highway Tolls (IOI18_highway) | C++17 | 162 ms | 9252 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;
typedef pair<int,int> pii;
#define f first
#define s second
/* ask with a vector saying the edge value (a or b) for each edge to know the smallest dist
1) find an edge in the path S -> T:
D&C in the edges, trying to find anyone that is in the path.
To do so, just paint everything with A and get the min dist from S to T
Then, in the D&C paint all edges at the current set with B, if it changes
the distance from S to T, than of these edges is in the path.
2) Let e be an edge in the path S -> T, how to find one of the endpoints, S or T ?
multisource bfs from the endpoints of e. Then enumerate the edges
according to their distante. Do bb in the prefix of edges, the last one that
changes the dist from S to T has S or T as the farthest endpoint.
3) Just do step 2) again
*/
const int maxn = 9e4 + 10;
vector<int> grafo[maxn];
int find_edge(int &n, int &m, vector<int> &u, vector<int> &v, int &a, int &b, int &d){ // log m queries
int l = 0, mid, r = m-1;
while(l != r){
mid = (l + r) >> 1;
vector<int> aux(m, 0);
for(int i=0; i<=mid; i++) aux[i] = 1;
if(ask(aux) != d) r = mid;
else l = mid + 1;
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... |