Submission #843618

# Submission time Handle Problem Language Result Execution time Memory
843618 2023-09-04T09:04:15 Z Elvin_Fritl Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

    #include "gap.h"

long long findGap(int t, int n)
{
    long long mini = 0 , maxi = 1e18 + 1;
    vector<long long>v;
    int tr = (n+1)/2;
    while(tr--)
    {
        long long l,r;
        MinMax(mini , maxi , &l , &r);
        v.push_back(l);
        if(l != r)
            v.push_back(r);
        mini = l + 1;
        maxi = r - 1;
    }
    sort(v.begin() , v.end());
    long long res = 0;
    for(int i=1;i<n;i++){
        res = max(v[i] , v[i-1] , res);
    }
	return res;
}

Compilation message

In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from gap.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
gap.cpp:24:38:   required from here
/usr/include/c++/10/bits/stl_algobase.h:303:17: error: '__comp' cannot be used as a function
  303 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~