# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
782410 | boyliguanhan | Mechanical Doll (IOI18_doll) | 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;
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
int M = U.size();
std::vector<int> w(M, 0);
long long toll = ask(w);
long long dis = toll/A;
int l = 0, r = N-1;
while(l<r) {
vector<int> v(M, 0);
int mid = l+r>>1;
for(int i = 0; i <= mid; i++)
v[i] = 1;
toll = ask(v);
if(toll==A*dis) {
l = mid+1;
} else if (toll==B*dis){
r = mid;
} else {
long long over = toll-dis*A;
over/=(B-A);
answer(mid-over+1, mid-over+1+dis);
return;
}
if(r-l+1==dis) {
answer(l, r+1);
return;
}
}
}