Submission #39603

# Submission time Handle Problem Language Result Execution time Memory
39603 2018-01-16T17:44:00 Z igzi Gap (APIO16_gap) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"

long long findGap(int t,int n){
    long long l=0,d=n+1,a[100005],m=0,i;
    for(i=0;i<n;i++){
        a[i]=-5;
    }
    a[0]=-1;
    a[n+1]=1000000000000000005;
    for(i=1;i<=(n+1)/2;i++){
        MinMax(a[l]+1,a[d]-1,&a[l+1],&a[d-1]);
        l++; d--;
    }
    for(i=1;i<l;i++){
        m=max(m,a[i]-a[i-1]);
    }
    for(i=d+1;i<n;i++){
        m=max(m,a[i]-a[i-1]);
    }
    return m;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:16:28: error: 'max' was not declared in this scope
         m=max(m,a[i]-a[i-1]);
                            ^
gap.cpp:16:28: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
gap.cpp:19:28: error: 'max' was not declared in this scope
         m=max(m,a[i]-a[i-1]);
                            ^
gap.cpp:19:28: note: suggested alternative:
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^