Submission #556429

#TimeUsernameProblemLanguageResultExecution timeMemory
556429InternetPerson10Gap (APIO16_gap)C++17
30 / 100
45 ms1880 KiB
#include "gap.h"
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

long long findGap(int T, int N) {
    if(T == 1 || T == 2) {
        vector<ll> nums(N);
        ll a, b, x, y, i = 0;
        a = 0, b = 1e18;
        while(i * 2 < N) {
            MinMax(a, b, &x, &y);
            nums[i] = x;
            nums[N - i - 1] = y;
            i++; a = x + 1; b = y - 1;
        }
        ll ans = 0;
        for(int i = 1; i < N; i++) {
            ans = max(ans, nums[i] - nums[i-1]);
        }
        return ans;
    }
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...