# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334589 | rocks03 | Finding Routers (IOI20_routers) | C++14 | 2 ms | 768 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int use_detector(int x);
vector<int> ask;
int use_use_detector(int x){
if(ask[x])
return ask[x];
return (ask[x] = use_detector(x));
}
vector<int> find_routers(int l, int n, int q){
ask.resize(l + 1);
vector<int> ans(n);
vector<int> maxpos(n, l);
ans[0] = 0;
int last = 0;
for(int i = 1; i < n; i++){
int l = last + 1, r = maxpos[i];
while(r - l > 1){
int m = (l + r) / 2;
int index = use_use_detector(m);
maxpos[index] = min(m, maxpos[index]);
if(index != i-1)
r = m;
else
l = m;
}
ans[i] = 2 * ((r - 1) - last) + last;
last = ans[i];
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |