Submission #733913

#TimeUsernameProblemLanguageResultExecution timeMemory
733913turbatGap (APIO16_gap)C++14
48.54 / 100
50 ms1176 KiB
#include "gap.h" #include <iostream> using namespace std; long long findGap(int T, int N) { long long mn, mx; MinMax(0, 1e18, &mn, &mx); long long gap = (mx - mn) / (N - 1); // cout << gap << endl; for (long long cur = mn; cur < mx;) { long long l, r; // cout << cur << " " << cur + gap << " "; MinMax(cur, cur + gap, &l, &r); // cout << l << " " << r << endl; if (l == r) { long long tmp = gap; l = -1; while (l == -1 && cur + tmp <= mx) { tmp += gap; // cout << "WHILE: " << cur + tmp - gap + 1 << " " << cur + tmp // << " "; MinMax(cur + tmp - gap + 1, cur + tmp, &l, &r); // cout << l << " " << r << endl; } // cout << l << " " << cur << endl; gap = l - cur; // cout << gap << endl; } cur = r; } // cout << "GAP: " << gap << endl; return gap; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...