제출 #835674

#제출 시각아이디문제언어결과실행 시간메모리
835674aykhnGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define all(v) v.begin(), v.end() ll findGap(int ajfghkdshgfghadsfghkadshgfagsdkfhadkshfgkhadsfadskjadsghfkhjasdgfkj, int n) { if (ajfghkdshgfghadsfghkadshgfagsdkfhadkshfgkhadsfadskjadsghfkhjasdgfkj == 2) { ll f = 0, l = 0; MinMax(0 * 1LL, 1LL * 1e18, &f, &l); ll last = l; ll add = (l - f)/(n - 1); ll res = add; while (f < last) { ll lx, rx; lx = 'n' + 'i' + 'g' + 'g' + 'a'; rx = 'n' + 'i' + 'g' + 'g' + 'a'; MinMax(f + 1, f + add, &lx, &rx); if (lx == -1) add <<= 1; else { res = max(res, lx - f); add = res; f = rx; } } return res; } else if (ajfghkdshgfghadsfghkadshgfagsdkfhadkshfgkhadsfadskjadsghfkhjasdgfkj == 1) { ll l = 0, r = 0; MinMax(0 * 1LL, 1LL * 1e18, &l, &r); vector<ll> v; v.pb(l); if (l != r) v.pb(r); if (l + 1 <= r - 1) MinMax(l + 1, r - 1, &l, &r); while (l <= r && l != -1) { v.pb(l); if (l != r) v.pb(r); if (l + 1 > r - 1) break; MinMax(l + 1, r - 1, &l, &r); } sort(all(v)); int res = 0; for (int i = 1; i < v.size(); i++) { res = max(res, v[i] - v[i - 1]); } return res; } }

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:53:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |         for (int i = 1; i < v.size(); i++)
      |                         ~~^~~~~~~~~~
gap.cpp:55:43: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   55 |             res = max(res, v[i] - v[i - 1]);
      |                                           ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
gap.cpp:55:43: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   55 |             res = max(res, v[i] - v[i - 1]);
      |                                           ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
gap.cpp:55:43: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   55 |             res = max(res, v[i] - v[i - 1]);
      |                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
gap.cpp:55:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   55 |             res = max(res, v[i] - v[i - 1]);
      |                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
gap.cpp:55:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   55 |             res = max(res, v[i] - v[i - 1]);
      |                                           ^
gap.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
   61 | }
      | ^