Submission #70604

#TimeUsernameProblemLanguageResultExecution timeMemory
70604polyfishGap (APIO16_gap)C++14
0 / 100
39 ms39312 KiB
//I love armpit fetish

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

#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

const long long INF = 1e18;
const int MAX_N = 100002;

int n;
long long a[MAX_N];

long long solve_subtask_1() {
    int l = 1, r = n;
    long long s = 1, t = INF;
    while (l<=r) {
        long long *mn;
        long long *mx;
        MinMax(s, t, mn, mx);
        a[l] = *mn;
        a[r] = *mx;
        s = *mn + 1;
        t = *mx - 1;
    }
    long long res = 0;
    for (int i=2; i<=n; ++i)
        res = max(res, a[i] - a[i-1]);
    return res;
}

long long findGap(int testID, int N) {
    n = N;
    if (testID==1)
        return solve_subtask_1();
    return 0;
//    else
//        return solve_subtask_2();
}

Compilation message (stderr)

gap.cpp: In function 'long long int solve_subtask_1()':
gap.cpp:25:15: warning: 'mn' may be used uninitialized in this function [-Wmaybe-uninitialized]
         MinMax(s, t, mn, mx);
         ~~~~~~^~~~~~~~~~~~~~
gap.cpp:25:15: warning: 'mx' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...