# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1201285 | AMel0n | Finding Routers (IOI20_routers) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,N) for(ll i = 0; i < N; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#include "routers.h"
vector<int> andy;
int cnt = 0;
void solve(int l, int r, int il, int ir) {
// cout << l << ' ' << r << ' ' << il << ' ' << ir << endl;
if (il >= ir) return;
if (l == r) {
andy[cnt++] = l-1;
// cout << il << ' ' << l << endl;
return ;
}
int m = (l+r)/2;
int im = use_detector(m);
solve(m+1, r, im, ir);
solve(l, m, il, im)()
}
vector<int> find_routers(int l, int n, int q) {
andy.resize(n);
solve(1, l, 0, n-1);
vector<int> res(n);
for(int i = 1; i < n; i++) res[i] = (andy[i-1]*2 - res[i-1]);
return res;
}
// signed main() {
// cin.tie(0); ios::sync_with_stdio(false);
// }