Submission #485575

#TimeUsernameProblemLanguageResultExecution timeMemory
485575dxz05Finding Routers (IOI20_routers)C++14
77.94 / 100
2 ms716 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; int mem[100005]; int ask(int x){ if (mem[x] == -1) mem[x] = use_detector(x); return mem[x]; } vector<int> find_routers(int len, int n, int q){ fill(mem, mem + len + 1, -1); vector<int> p(n); for (int i = 1; i < n; i++){ int l = p[i - 1] + 1, r = len; while (l <= r) { int m = (l + r) >> 1; if (ask(m) == i - 1){ l = m + 1; } else r = m - 1; } l--; p[i] = 2 * l - p[i - 1]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...