제출 #242066

#제출 시각아이디문제언어결과실행 시간메모리
242066michaoGap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; typedef long long ll; #define pb push_back int n; vector<ll>pom,answer; long long findGap(int t, int N) { n=N; int ans=0; int ip=-1,ik=1e19; if (t==1) { while ((int)answer.size()+(int)pom.size()<n) { ip++,ik--; MinMax(ip,ik,&ip,&ik); answer.pb(ip); pom.pb(ik); } } else { assert(false); } while ((int)pom.size()>0)answer.pb(pom.back()),pom.pop_back(); for (int i=0;i<(int)answer.size()-1;i++)ans=max(ans,answer[i+1]-answer[i]); return ans; }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:12:15: warning: overflow in implicit constant conversion [-Woverflow]
  int ip=-1,ik=1e19;
               ^~~~
gap.cpp:18:24: error: cannot convert 'int*' to 'long long int*' for argument '3' to 'void MinMax(long long int, long long int, long long int*, long long int*)'
    MinMax(ip,ik,&ip,&ik);
                        ^
gap.cpp:28:75: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type)'
  for (int i=0;i<(int)answer.size()-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                                                                           ^
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:1:
/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:28:75: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}')
  for (int i=0;i<(int)answer.size()-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                                                                           ^
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:1:
/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:28:75: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}')
  for (int i=0;i<(int)answer.size()-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                                                                           ^
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:1:
/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:28:75: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  for (int i=0;i<(int)answer.size()-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                                                                           ^
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:1:
/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:28:75: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  for (int i=0;i<(int)answer.size()-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                                                                           ^