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;
typedef long long int ll;
#define REP(i, a, b) for (ll i=a; i<b; i++)
#define pb push_back
std::vector<int> find_routers(int l, int n, int q)
{
vector<int> ans(n);
int minimo[n] = {};
int maximo[n];
REP(i, 0, n)
maximo[i] = l;
REP(i, 0, n)
{
while (minimo[i] < maximo[i])
{
int med = (minimo[i] + maximo[i] + 1)/2;
int x = use_detector(med);
for (int j=x; j>=0; j--)
{
if (maximo[j] <= med - 1)
break;
maximo[j] = med - 1;
}
REP(j, x+1, n)
{
if (minimo[j] >= med)
break;
minimo[j] = med;
}
}
}
ans[0] = 0;
REP(i, 1, n)
ans[i] = 2*minimo[i] - ans[i-1];
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... |