Submission #813016

#TimeUsernameProblemLanguageResultExecution timeMemory
813016PikachuGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long

using namespace std;

template<typename T>
inline bool maxi(T &x, const T &val)
{
    if (x < val) return x = val, true;
    return false;
}

template<typename T>
inline bool mini(T &x, const T &val)
{
    if (x > val) return x = val, true;
    return false;
}

const int maxn = 1e5 + 10, oo = 1e18;
int n;
int a[maxn];
int res;

void MinMax(long long s, long long t, long long *mn, long long *mx);

int solve1()
{
    int st = 0, en = oo;
    int *tmpn = new int(0), *tmpx = new int(oo);
    int curst = 1, curen = n;
    while (curst <= curen) {
        MinMax(st, en, tmpn, tmpx);
        a[curst++] = *tmpn;
        st = *tmpn + 1;
        a[curen--] = *tmpx;
        en = *tmpx - 1;
    }
    for (int i = 1; i < n; i++) {
        maxi(res, a[i + 1] - a[i]);
    }
    return res;
}

int solve2()
{

}

int findGap(int sub, int n)
{
    ::n = n;
    if (sub == 1) return solve1();
    else return solve2();
}

#undef int

Compilation message (stderr)

gap.cpp: In function 'long long int solve2()':
gap.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
/usr/bin/ld: /tmp/cc0rzCY8.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status