Submission #32239

# Submission time Handle Problem Language Result Execution time Memory
32239 2017-10-05T03:38:53 Z dqhungdl Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h";
using namespace std;

int a[100005];

int64_t findGap(int T, int n)
{
    MinMax(0,1e18,a[1],a[n]);
    int i=2,j=n-1;
    while(i<=j)
        MinMax(a[i-1]+1,a[j+1]-1,a[i],a[j]);
    int64_t res=0;
    for(int i=2;i<=n;i++)
        res=max(res,a[i]-a[i-1]);
    return res;
}

Compilation message

gap.cpp:2:17: warning: extra tokens at end of #include directive
 #include "gap.h";
                 ^
gap.cpp: In function 'int64_t findGap(int, int)':
gap.cpp:9:22: error: invalid conversion from 'int' to 'long long int*' [-fpermissive]
     MinMax(0,1e18,a[1],a[n]);
                      ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:9:27: error: invalid conversion from 'int' to 'long long int*' [-fpermissive]
     MinMax(0,1e18,a[1],a[n]);
                           ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:12:37: error: invalid conversion from 'int' to 'long long int*' [-fpermissive]
         MinMax(a[i-1]+1,a[j+1]-1,a[i],a[j]);
                                     ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:12:42: error: invalid conversion from 'int' to 'long long int*' [-fpermissive]
         MinMax(a[i-1]+1,a[j+1]-1,a[i],a[j]);
                                          ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:15:32: error: no matching function for call to 'max(int64_t&, int)'
         res=max(res,a[i]-a[i-1]);
                                ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
gap.cpp:15:32: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
         res=max(res,a[i]-a[i-1]);
                                ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from gap.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/5/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
gap.cpp:15:32: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
         res=max(res,a[i]-a[i-1]);
                                ^
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:3457:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^
/usr/include/c++/5/bits/stl_algo.h:3457:5: note:   template argument deduction/substitution failed:
gap.cpp:15:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
         res=max(res,a[i]-a[i-1]);
                                ^
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: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
/usr/include/c++/5/bits/stl_algo.h:3463:5: note:   template argument deduction/substitution failed:
gap.cpp:15:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
         res=max(res,a[i]-a[i-1]);
                                ^