제출 #753479

#제출 시각아이디문제언어결과실행 시간메모리
753479KN200711Gap (APIO16_gap)C++14
70 / 100
48 ms1156 KiB
#include "gap.h" # include <bits/stdc++.h> # define ll long long using namespace std; long long findGap(int T, int N) { ll lw = 0ll, hg = 0ll; MinMax(0ll, 1ll * 1e18, &lw, &hg); ll diff = hg - lw; diff = (diff + 1ll * N - 2ll) / (N - 1ll); ll ls = -1; while(lw < hg) { ll mn, mx; MinMax(lw, min(1ll * lw + 1ll * diff, (ll) 1e18), &mn, &mx); lw += diff + 1ll; if(mn == mx && mn == -1) continue; if(ls == -1) ls = mx; else { diff = max(diff, mn - ls); ls = mx; } } return diff; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...