# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425264 | arneves | Highway Tolls (IOI18_highway) | C++17 | 45 ms | 5480 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 long long ll;
vector<int> adj[200000];
/*
5 4 16 20 1 4
0 1
1 2
2 3
3 4
****************
5 4 16 20 1 3
0 1
1 2
2 3
3 4
****************
5 4 16 20 0 2
0 1
1 2
2 3
3 4
****************
5 4 16 20 3 4
0 1
1 2
2 3
3 4
*/
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
int M=U.size();
ll tamanho;
vector<int> w(M,0);
ll ultima=ask(w), atual;
tamanho=(ultima/A)+1;
w[0]=1;
int l=0, r=N-2, m;
if(ask(w)!=ultima){
answer(0,tamanho-1);
return;
}
{
while(l<r){
m=(l+r)/2;
for(int i=0; i<M; i++){
if(i<=m){
w[i]=0;
}else{
w[i]=1;
}
//cout<<w[i]<<' ';
}
//cout<<'\n';
atual=ask(w);
if(atual/B==ultima/A){
l=m+1;
}else{
r=m;
}
}
}
//cout<<m+1<<' '<<m+tamanho<<'\n';
answer(m+1, m+tamanho);
}
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... |