Submission #242065

#TimeUsernameProblemLanguageResultExecution timeMemory
242065michaoGap (APIO16_gap)C++14
Compilation error
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=inf; if (t==1) { while (sz(answer)+sz(pom)<n) { ip++,ik--; MinMax(ip,ik,&ip,&ik); answer.pb(ip); pom.pb(ik); } } else { assert(false); } while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back(); for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:12:15: error: 'inf' was not declared in this scope
  int ip=-1,ik=inf;
               ^~~
gap.cpp:12:15: note: suggested alternative: 'ynf'
  int ip=-1,ik=inf;
               ^~~
               ynf
gap.cpp:15:10: error: 'sz' was not declared in this scope
   while (sz(answer)+sz(pom)<n)
          ^~
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:27:9: error: 'sz' was not declared in this scope
  while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
         ^~
gap.cpp:28:17: error: 'sz' was not declared in this scope
  for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                 ^~
gap.cpp:28:67: 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<sz(answer)-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:67: 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<sz(answer)-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:67: 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<sz(answer)-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:67: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  for (int i=0;i<sz(answer)-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:67: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                                                                   ^