Submission #843894

# Submission time Handle Problem Language Result Execution time Memory
843894 2023-09-04T16:40:10 Z Elvin_Fritl Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include "gap.h"

#include <bits/stdc++.h>
using namespace std;


long long findGap(int t, int n)
{
    long long mn = 0 , mx = 1e18 + 1;
    vector<long long>v;
    int tr = (n+1)/2;
    while(tr--)
    {
        MinMax(mn , mx , &mn , &mx);
        v.push_back(mn);
        if(mn != mx)
            v.push_back(mx);
        mn++;
        mx--;
    }
    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:4:
/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:25: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))
      |           ~~~~~~^~~~~~~~~~