제출 #623586

#제출 시각아이디문제언어결과실행 시간메모리
623586jophyyjhFinding Routers (IOI20_routers)C++14
70.13 / 100
2 ms340 KiB
/**
 * Not hard.
 * 
 * Steps needed:  n * log_2(l)
 * Implementation 1
*/

#include <bits/stdc++.h>
#include "routers.h"

typedef std::vector<int>  vec;


vec find_routers(int l, int n, int q) {
    vec ans = {0};
    for (int i = 0; i < n - 1; i++) {
        int prev = ans.back();
        int a = prev, b = l;
        while (a < b) {
            int mid = (a + b + 1) / 2;
            if (use_detector(mid) == i)
                a = mid;
            else
                b = mid - 1;
        }
        ans.push_back(2 * a - prev);
    }
    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...