Submission #38744

# Submission time Handle Problem Language Result Execution time Memory
38744 2018-01-06T11:45:03 Z oTTo_22 Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"
#define se second
#define fi first
using namespace std;

long long ans;

void func (long long L,long long R) {
    long long mi1,ma1,mi2,ma2;
    long long mid=(L+R)/2;
    MinMax(L,mid,&mi1,&ma1);
    MinMax(mid,R,&mi2,&ma2);
    if (mi1==-1 && mi2==-1) {
        ans=max(ans,R-L);
        return;
    }
    if (mi1==-1) {
        ans=max(ans,mi2-L);
        return;
    }
    if (mi2==-1) {
        ans=max(ans,R-ma1);
        return;
    }
    if (ma1-L>ans)
        func(L,ma1);
    if (R-mi2>ans)
        func(mi2,R);
}

long long findGap(int T, int N)
{
    long long Mn,Mx;
    long long S=0;
    long long TT=1000000000000000000;
    MinMax(S,TT,&Mn,&Mx);
    if (n==2)
        return Mx-Mn;
    ans=0;
    func (Mn,Mx);
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:38:9: error: 'n' was not declared in this scope
     if (n==2)
         ^