제출 #668300

#제출 시각아이디문제언어결과실행 시간메모리
668300danikoynovGap (APIO16_gap)C++14
0 / 100
61 ms5832 KiB

#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

long long findGap(int T, int N)
{
    ll lf = 0, rf = 1e18, mn, mx;
    MinMax(lf, rf, &mn, &mx);
   set < ll > st;
   int nn = 0;
   while(nn < N)
    {
        MinMax(lf, rf, &mn, &mx);
        st.insert(mn);
        st.insert(mx);
        lf = mn + 1;
        rf = mx - 1;
        nn += 2;
    }

    ll ans = 0;
    ll last = -1;
    for (auto it : st)
    {
        if (last != -1)
            ans = max(ans, it - last);
        last = it;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...