Submission #623582

#TimeUsernameProblemLanguageResultExecution timeMemory
623582jophyyjhFinding Routers (IOI20_routers)C++14
42.19 / 100
2 ms312 KiB
/**
 * Simple.
 * 
 * Steps needed:  n * log(x)
 * 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(), mid = prev;
        for (int step = l / 2 + 1; step >= 1; step /= 2) {
            while (mid + step <= l && use_detector(mid + step) == i)
                mid += step;
        }
        ans.push_back(2 * mid - 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...