답안 #39587

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
39587 2018-01-16T17:06:27 Z igzi Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

long long findGap(int t,long long n){
    long long l=0,d=n,x=-1,y=1e18+1,a[maxN],m=0;
    for(int i=0;i<n;i++){
        a[i]=-1;
    }
    while(y!=-1){
        MinMax(x+1,y-1,&x,&y);
        a[l]=x;
        a[d]=y;
        l++; d++;
    }
    for(int i=1;i<n;i++){
        if(a[i]!=-1 && a[i-1]!=-1 && a[i]-a[i-1]>m) m=a[i]-a[i-1];
    }
    return m;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, long long int)':
gap.cpp:4:39: error: 'maxN' was not declared in this scope
     long long l=0,d=n,x=-1,y=1e18+1,a[maxN],m=0;
                                       ^
gap.cpp:6:9: error: 'a' was not declared in this scope
         a[i]=-1;
         ^
gap.cpp:9:29: error: 'MinMax' was not declared in this scope
         MinMax(x+1,y-1,&x,&y);
                             ^
gap.cpp:10:9: error: 'a' was not declared in this scope
         a[l]=x;
         ^
gap.cpp:15:12: error: 'a' was not declared in this scope
         if(a[i]!=-1 && a[i-1]!=-1 && a[i]-a[i-1]>m) m=a[i]-a[i-1];
            ^