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 <bits/stdc++.h>
#include "routers.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
const int INF = 2e9, N = 2e5+15, M = 998244353, LOG = 16;
const ll LINF = 1e18;
vector<int> find_routers(int l, int n, int q) {
vector<int> R(n, l);
vector<int> ans {0};
for(int i = 1; i < n; i++)
{
int s = ans.back()+1, e = R[i];
while(s < e) {
int m = (s + e + 1) / 2;
int cur = use_detector(m);
if(cur > i-1) {
--cur;
e = m-1;
R[cur] = min(R[cur], m);
}
else s = m;
q--;
}
ans.push_back(ans.back() + 2 * (s - ans.back()));
}
assert(q >= 0);
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... |