Submission #796378

#TimeUsernameProblemLanguageResultExecution timeMemory
796378TheSahibGap (APIO16_gap)C++14
12.65 / 100
40 ms1292 KiB
#include "gap.h"
#include <bits/stdc++.h>

#define ll long long
#define pii pair<int, int>

using namespace std;

const ll MAX = 1000000000000000000ll;

ll findGap(int T, int N)
{
    ll mn, mx;
    MinMax(0, MAX, &mn, &mx);
    ll ans = 1;
    ll p = mn;
    while(p != mx){
        ll l = 0, h = 0;
        ll dist = ans;
        while(true){
            MinMax(p + 1, p + dist, &l, &h);
            if(l == -1){
                dist *= 2;
                continue;
            }
            ans = max(ans, l - p);
            p = h;
            break;
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...