이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "routers.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll,ll> pll;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
#define forr(_a,_b,_c) for(int _a = (_b); _a <= (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < (_c); ++_a)
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define mask(i) (1LL << (i))
#define bit(x, i) (((x) >> (i)) & 1)
#define bp __builtin_popcountll
#define file "test"
const int N = 5e5 + 5;
const ll oo = 1e9;
const ll mod = 1e9 + 7; // 998244353;
int pos[N];
void calc (int l, int r, int opl, int opr){
if (l > r) return;
if (l == r){
pos[l] = opl;
return;
}
int m = (l + r) >> 1;
int low = opl, high = opr;
while (low < high){
int mid = (low + high) >> 1;
if (use_detector(mid) < m)
low = mid + 1;
else high = mid;
}
pos[m] = low - 1;
calc (l, m - 1, opl, low - 1);
calc (m + 1, r, low + 1, opr);
}
vector <int> find_routers (int len, int n, int q){
vector <int> a(n, 0);
calc (1, n - 1, 1, len ^ 1);
forf (i, 1, n)
a[i] = pos[i] + pos[i] - a[i - 1];
return a;
}
# | 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... |