Submission #585321

#TimeUsernameProblemLanguageResultExecution timeMemory
585321Do_you_copyGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <gap.h>
#define taskname "test"
#define fi first
#define se second
#define pb push_back
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;

using ll = long long;
using pii = pair <int, int>;

ll min(const ll &a, const ll &b){
    return (a < b) ? a : b;
}

ll max(const ll &a, const ll &b){
    return (a > b) ? a : b;
}

const ll Mod = 1000000007;
const int maxN = 1e5 + 1;
const ll inf = LLONG_MAX;
int n;
ll a[maxN];

ll findGap(int T, long int N){
    if (T & 1){
        ll mn, mx;
        MinMax(0, inf, &mn, &mx);
        a[1] = mn, a[N] = mx;
        for (int i = 2; i <= (N + 1) / 2; ++i){
            MinMax(mn + 1, mx - 1, &mn, &mx);
            a[i] = mn, a[N - i + 1] = mx;
        }
        ll ans = 0;
        for (int i = 2; i <= N; ++i){
            ans = max(ans, a[i] - a[i - 1]);
        }
        return ans;
    }
    else{
        ll mn, mx;
        MinMax(0, inf, &mn, &mx);
        ll ans = 0, i = mn, last = LLONG_MAX;
        int j = (mx - mn) / (N - 1);
        for (; i <= mx; i += j){
            ll x, y;
            MinMax(i, i + j, &x, &y);
            ans = max(ans, x - last);
            last = y;
        }
        return ans;
    }
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccpgDK3Y.o: in function `main':
grader.cpp:(.text.startup+0x1b7): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status