제출 #971031

#제출 시각아이디문제언어결과실행 시간메모리
971031aryanc403Finding Routers (IOI20_routers)C++17
70.49 / 100
1 ms604 KiB
#include "routers.h"
using namespace std;

std::vector<int> find_routers(int l, int n, int q) {

    auto getNextPoint = [&](const int idx)->int{
    	int low=-1,up=l+1;
    	while(up-low>1){
    		const int mid = (low+up)/2;
    		if(use_detector(mid)>=idx)
    			up=mid;
    		else
    			low=mid;
    	}
    	return up;
    };

    std::vector<int> ans(n);
    for (int i = 1; i < n; i++) {
    	const int mid = getNextPoint(i)-1;
    	ans[i]=2*mid-ans[i-1];
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...