Submission #1319514

#TimeUsernameProblemLanguageResultExecution timeMemory
1319514husseinjuandaGap (APIO16_gap)C++20
70 / 100
46 ms1204 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define ll long long long long findGap(int T, int n) { ll mn = 0; ll mx = 0; MinMax(0, 1e18, &mn, &mx); ll l = mn; ll r = mx; ll pgh = (mx - mn)/(n-1); if((mx - mn)%(n-1) != 0){ pgh++; } pgh--; // cout << pgh << endl; ll cur = l+1; ll lst = l; ll ns = 0; while(cur <= r){ if(cur == r){ mx = max(mx, r-lst); break; } //cur, cur + pgh MinMax(cur, min(cur+pgh, r), &mn, &mx); cur += pgh+1; if(mn == -1) continue; ns = max(ns, mn-lst); lst = mx; } return ns; } // 2 3 4 5 6 7 8
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...