| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 307093 | phathnv | Finding Routers (IOI20_routers) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "routers.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> find_routers(int l, int n, int q){
vector <int> res;
res.push_back(0);
int cur = 0;
if (n == 2){
int mid = 1;
for(int j = 16; j >= 0; j--){
if (mid + (1 << j) > l)
continue;
if (use_detector(mid + (1 << j)) == i - 1)
mid += (1 << j);
}
res.push_back(2 * mid);
return res;
}
for(int i = 1; i < n; i++){
int mid = cur + 1;
while (use_detector(min(l, mid + 64)) == i - 1)
mid = min(l, mid + 64);
for(int j = 5; j >= 0; j--){
if (mid + (1 << j) > l)
continue;
if (use_detector(mid + (1 << j)) == i - 1)
mid += (1 << j);
}
int nxt = 2 * mid - cur;
res.push_back(nxt);
cur = nxt;
}
return res;
}
