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;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using i64 = int64_t;
using vl = vector<i64>;
using ll = pair<i64, i64>;
using vll = vector<ll>;
constexpr int iINF = numeric_limits<int>::max();
constexpr i64 lINF = numeric_limits<i64>::max();
#define RANGE(x) begin(x), end(x)
template <typename... T>
void DBG(T&&... args) {
((cerr << args << ' '), ...) << '\n';
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &vec) {
out << '{';
for (size_t i = 0; i < vec.size()-1; ++i)
out << vec[i] << ", ";
out << vec.back() << '}';
return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &pr) {
out << '(' << pr.first << ", " << pr.second << ')';
return out;
}
std::vector<int> find_routers(int l, int n, int q) {
std::vector<int> ans(n, 0);
vi queries(l);
iota(RANGE(queries), 0);
int prv = 0;
for (int i = 1; i < n; ++i) {
int border = lower_bound(queries.begin(), queries.end(), i, [&] (const int a, int b) {
int x = a;
if (x > 0) queries[a] = x = -use_detector(a);
return -x < b;
}) - queries.begin() - 1;
int dist = border - prv;
int nxt = border + dist;
ans[i] = nxt;
prv = nxt;
}
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... |