이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "routers.h"
#include <iostream>
#include <vector>
//#include <chrono>
using namespace std;
vector<int> find_routers(int l, int n, int q) {
//auto started = std::chrono::high_resolution_clock::now();
vector<int> ans;
ans.push_back(0);
int prev = 0, check = 0, mid = 0, lo =0, hi = l, c =0;
bool found = 0;
for(int next=1; next<n; next++){
lo = ans[next-1], hi = l;
found =0;
//int asd = 0;
while(!found && lo<hi){
//asd++;
mid = lo + (hi-lo)/2;
check = use_detector(mid);
//cout<<lo<<" "<<hi<<" "<<mid<<" "<<check<<" "<<prev<<" "<<asd<<"\n";
if(check == prev){
c = use_detector(mid+1);
if(c == next){
ans.push_back(mid*2 - ans[next-1]);
lo = mid+1;
prev = next;
found =1;
}
else{
lo = mid;
}
}
else{
hi = mid;
}
}
}
//auto done = std::chrono::high_resolution_clock::now();
//std::cout <<"\nmls "<< std::chrono::duration_cast<std::chrono::milliseconds>(done-started).count()<<"\n";
return ans;
}
# | 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... |