답안 #23286

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23286 2017-05-05T22:34:35 Z repeating Gap (APIO16_gap) C++11
컴파일 오류
0 ms 0 KB
//#include <bits/stdc++.h>
//using namespace std;
long long findGap(int, int);
void MinMax(long long , long long , long long *, long long *);
long long findGap(int T, int N)
{
    if(T == 2)
    {
        long long mmin, mmax;
        MinMax(0LL,MAXN,&mmin,&mmax);
        long long gap = (mmax-mmin-1)/(N-1), res = -1;
        long long L = mmin+1, prevMax = mmin;
        while(L<=mmax)
        {
            long long curMin, curMax;
            MinMax(L,L+gap,&curMin,&curMax);
            if(curMin != -1 && curMax != -1)
            {
                long long curDiff = curMin - prevMax;
                res = (curDiff > res ? curDiff : res);
                prevMax = curMax;
            }
            L += gap+1;
        }
        return res;
    }
    long long aray[N], i = 0, j = N-1, lo = 0, hi = MAXN;
    while(j-i >= 0)
    {
        long long x, y;
        MinMax(lo,hi,&x,&y);
        aray[i] = x, aray[j] = y;
        i++, j--;
        lo = x+1;
        hi = y-1;
    }

    long long res = -1;
    for(int i = 0; i+1 < N; i++)
        res = (res < aray[i+1]-aray[i] ? aray[i+1]-aray[i] : res);
    return res;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:20: error: 'MAXN' was not declared in this scope
         MinMax(0LL,MAXN,&mmin,&mmax);
                    ^
gap.cpp:27:53: error: 'MAXN' was not declared in this scope
     long long aray[N], i = 0, j = N-1, lo = 0, hi = MAXN;
                                                     ^