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>
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
map<int, int> detus;
int dtu;
int det(int x)
{
if (detus.count(x))
return detus[x];
dtu++;
return detus[x] = use_detector(x);
}
int findrouter(int b, int e, int v)
{
while (e - b != 1)
{
if (det((e + b) / 2) < v)
b = (e + b) / 2;
else
e = (e + b) / 2;
}
return b;
}
std::vector<int> find_routers(int l, int n, int q)
{
std::vector<int> ans(1, 0);
for (int i = 1; i < n; i++)
{
int t = findrouter(1, l, i);
int dist = t - ans.back();
ans.push_back(dist * 2 + 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... |