Submission #560889

#TimeUsernameProblemLanguageResultExecution timeMemory
560889duypd4206Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h"
#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:15:50: error: expected ';' before '}' token
   15 |             MinMax(a[i-1]+1,a[j+1]-1,&a[i],&a[j])
      |                                                  ^
      |                                                  ;
   16 |         }
      |         ~                                         
gap.cpp:17:19: error: 'oo' was not declared in this scope
   17 |         ll res = -oo;
      |                   ^~
gap.cpp:35:13: error: 'res' was not declared in this scope
   35 |             res = max(res, mn - Pre+1);
      |             ^~~
gap.cpp:38:12: error: 'res' was not declared in this scope
   38 |     return res;
      |            ^~~