# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
768190 | raysh07 | Travelling Merchant (APIO17_merchant) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int t, int n)
{
long long mx, mn;
MinMax(1, (long long)1e18, &mn, &mx);
long long ans = (mx - mn + n - 1) / n;
long long last = mn;
//go from s to t, but make jumps of size ans
long long curr = mn + 1;
while (curr <= mx){
//query [curr, curr + ans]
long long mi, ma;
MinMax(curr, curr + ans, &mi, &ma);
curr += ans;
if (mi == -1){
continue;
}
ans = max(mi - last, ans);
last = ma;
}
return ans;
}