답안 #70603

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70603 2018-08-23T07:21:01 Z polyfish Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
//I love armpit fetish

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

#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

const long long INF = 1e18;
const int MAX_N = 100002;

int n;
long long a[MAX_N];

long long solve_subtask_1() {
    int l = 1, r = n;
    long long s = 1, t = INF;
    while (l<=r) {
        long long *mn;
        long long *mx;
        MinMax(s, t, mn, mx);
        a[l] = *mn;
        a[r] = *mx;
        s = *mn + 1;
        t = *mx - 1;
    }
    int64_t res = 0;
    for (int i=2; i<=n; ++i)
        res = max(res, a[i] - a[i-1]);
    return res;
}

long long findGap(int testID, int N) {
    n = N;
    if (testID==1)
        return solve_subtask_1();
    return 0;
//    else
//        return solve_subtask_2();
}

Compilation message

gap.cpp: In function 'long long int solve_subtask_1()':
gap.cpp:33:37: error: no matching function for call to 'max(int64_t&, long long int)'
         res = max(res, a[i] - a[i-1]);
                                     ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:3:
/usr/include/c++/7/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++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
gap.cpp:33:37: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
         res = max(res, a[i] - a[i-1]);
                                     ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:3:
/usr/include/c++/7/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++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
gap.cpp:33:37: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
         res = max(res, a[i] - a[i-1]);
                                     ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:3:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
gap.cpp:33:37: 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++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:3:
/usr/include/c++/7/bits/stl_algo.h:3468: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++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:33:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
         res = max(res, a[i] - a[i-1]);
                                     ^