Submission #560888

#TimeUsernameProblemLanguageResultExecution timeMemory
560888duypd4206Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 2;

ll findGap(int t, int n)
{
    ll a[maxn];
    if(t==1){
        a[0] = -1;
        a[n+1] = 2e18 + 1;
        for(int i = 1, j = n; i <= j; i++,j--)
        {
            MinMax(a[i-1]+1,a[j+1]-1,&a[i],&a[j])
        }
        ll res = -oo;
        for(int i = 1; i < n ; i++)
            res = max(res,abs(a[i+1] - a[i]));
        return res;
    }
    ll mn = 0,mx = 1e18;
    MinMax(0,1e18,&mn,&mx);
    ll gap = (mx - mn) / n;
    ll Pre = -1;
    if(n == 2) return mx - mn;
    n--;
    ll t1 = mn, t2 = mx;
    for(ll be = t1; be < t2; be+= gap + 1)
    {
        MinMax(be, be + gap,&mn,&mx);
        if(mn == -1)
            continue;
        if(Pre != -1)
            res = max(res, mn - Pre+1);
        Pre = mx;
    }
    return res;
}

//int main()
//{
//
//}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:14:13: error: 'MinMax' was not declared in this scope
   14 |             MinMax(a[i-1]+1,a[j+1]-1,&a[i],&a[j])
      |             ^~~~~~
gap.cpp:16:19: error: 'oo' was not declared in this scope
   16 |         ll res = -oo;
      |                   ^~
gap.cpp:22:5: error: 'MinMax' was not declared in this scope
   22 |     MinMax(0,1e18,&mn,&mx);
      |     ^~~~~~
gap.cpp:34:13: error: 'res' was not declared in this scope
   34 |             res = max(res, mn - Pre+1);
      |             ^~~
gap.cpp:37:12: error: 'res' was not declared in this scope
   37 |     return res;
      |            ^~~