제출 #733871

#제출 시각아이디문제언어결과실행 시간메모리
733871turbatGap (APIO16_gap)C++14
0 / 100
3097 ms1172 KiB
#include "gap.h" #include <iostream> using namespace std; long long findGap(int T, int N) { // cout << "T: " << T << " N: " << N << endl; long long mn, mx; MinMax(0, 1e18, &mn, &mx); long long gap = (mx - mn) / (N - 1); // cout << mn << " " << mx << endl; for (int cur = mn; cur <= mx; cur += gap) { long long l, r; // cout << cur << " " << cur + gap << " "; MinMax(cur, cur + gap, &l, &r); // cout << l << " " << r << endl; if (l == r) { // time to binary search hhe long long tmp = gap; while (cur != l && cur + tmp <= mx) { tmp += gap; // cout << cur + tmp - gap + 1 << " " << cur + tmp << " "; MinMax(cur + tmp - gap + 1, cur + tmp, &l, &r); // cout << l << " " << r << endl; // cout << cur + tmp - gap + 1 << " " << cur + tmp << " " << l // << " " << r << endl; } gap = l - cur; cur = l; } else { cur = r; } } // cout << "GAP: " << gap << endl; return gap; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...