This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "routers.h"
#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> dp;
std::vector<int> find_routers(int l, int n, int q) {
std::vector<int> sna;
int curr = n-1;
int low = 0, high = l, mid;
while (curr != 0) {
while (low != high) {
mid = (low+high+1)/2;
int res;
if (dp.find(mid) != dp.end()) res = dp[mid];
else {
res = use_detector(mid);
dp[mid] = res;
}
if (res >= curr) high = mid-1;
else low = mid;
}
sna.push_back(low);
high = l;
low = 0;
curr--;
}
vector<int> ans;
ans.push_back(0);
for (int i = sna.size()-1; i >= 0; i--) {
ans.push_back(2*sna[i] - ans.back());
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |