Submission #835638

#TimeUsernameProblemLanguageResultExecution timeMemory
835638aykhnGap (APIO16_gap)C++14
0 / 100
20 ms1104 KiB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll findGap(int asdposjidfjioafg, int n)
{
    ll f = 0, l = 0;
    MinMax(0LL, 1LL * 1e18, &f, &l);
    ll last = l;

    ll add = (l - f)/(n - 1);
    ll lim = (l - f - n + 1);

    ll res = 0;

    while (l < last)
    {
        ll lx, rx;
        lx = f;
        rx = l;
        f++;
        MinMax(f, f + add - 1, &lx, &rx);
        if (lx == -1)
        {
            add *= 2;
        }
        else
        {
            res = max(res, lx - (f - 1) + 1);
        }
    }
    return res;

}

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:14:8: warning: unused variable 'lim' [-Wunused-variable]
   14 |     ll lim = (l - f - n + 1);
      |        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...