이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
const ll Inf = 1e18;
ll findGap(int Tc, int N){
assert(Tc == 2);
ll L, R, S, T;
MinMax(0ll, Inf, &L, &R);
ll D = (R - L) / (N - 1);
ll md = (R - L) % (N - 1);
ll pos = L;
ll st;
vector<ll> V;
for(int i = 0; i < N - 1; i++){
st = D;
if(i < md) st ++;
MinMax(pos, pos + st - 1, &S, &T);
if(S != -1){
V.push_back(S);
V.push_back(T);
}
pos += st;
}
sort(V.begin(), V.end());
ll ans = D + min(md, 1ll);
for(int i = 0; i + 1 < (int) V.size(); i++) ans = max(ans, V[i + 1] - V[i]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |