Submission #527941

#TimeUsernameProblemLanguageResultExecution timeMemory
527941tabrFinding Routers (IOI20_routers)C++17
0 / 100
3 ms588 KiB
#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

#ifdef tabr
function<int(int)> use_detector(int);
#else
#include "routers.h"
#endif

vector<int> find_routers(int l, int n, int) {
    vector<int> a(n - 1);
    map<int, int> mp;
    auto Ask = [&](int x) {
        if (!mp.count(x)) {
            mp[x] = use_detector(x);
        }
        return mp[x];
    };
    for (int i = 0; i < n - 1; i++) {
        int low = 0;
        int high = l + 1;
        while (high - low > 1) {
            int mid = (high + low) >> 1;
            if (Ask(mid) <= i) {
                low = mid;
            } else {
                high = mid;
            }
        }
        a[i] = low;
    }
    vector<int> ans(n);
    for (int i = 1; i < n; i++) {
        ans[i] = 2 * ans[i - 1] - ans[i - 1];
    }
    return ans;
}

#ifdef tabr
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    return 0;
}
#endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...