Submission #266605

#TimeUsernameProblemLanguageResultExecution timeMemory
266605dCodingGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define F0R(i,n) for(int i = 0; i < (n); i++) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define ll long long #define pb push_back long long findGap(int T, int N) { vector<ll> a; ll lo = 0, hi = 1e18; while((int)a.size() < N) { ll *mn = 0,*mx = 0; MinMax(lo,hi,mn,mx); if(mn == mx) { a.pb(mn); } else { a.pb(mn); a.pb(mx); hi = mx-1; lo = mn+1; assert(lo <= hi); } } ll ans = 0; sort(a.begin(),a.end()); FOR(i,1,N-1) ans = max(ans,a[i]-a[i-1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:19:28: error: no matching function for call to 'push_back(long long int*&)'
   19 |                     a.pb(mn);
      |                            ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from gap.cpp:4:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]' <near match>
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:19:26: error: invalid conversion from 'long long int*' to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   19 |                     a.pb(mn);
      |                          ^~
      |                          |
      |                          long long int*
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from gap.cpp:4:
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]' <near match>
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:19:26: error: invalid conversion from 'long long int*' to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   19 |                     a.pb(mn);
      |                          ^~
      |                          |
      |                          long long int*
gap.cpp:21:28: error: no matching function for call to 'push_back(long long int*&)'
   21 |                     a.pb(mn); a.pb(mx);
      |                            ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from gap.cpp:4:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]' <near match>
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:21:26: error: invalid conversion from 'long long int*' to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   21 |                     a.pb(mn); a.pb(mx);
      |                          ^~
      |                          |
      |                          long long int*
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from gap.cpp:4:
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]' <near match>
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:21:26: error: invalid conversion from 'long long int*' to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   21 |                     a.pb(mn); a.pb(mx);
      |                          ^~
      |                          |
      |                          long long int*
gap.cpp:21:38: error: no matching function for call to 'push_back(long long int*&)'
   21 |                     a.pb(mn); a.pb(mx);
      |                                      ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from gap.cpp:4:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]' <near match>
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:21:36: error: invalid conversion from 'long long int*' to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   21 |                     a.pb(mn); a.pb(mx);
      |                                    ^~
      |                                    |
      |                                    long long int*
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from gap.cpp:4:
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]' <near match>
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:21:36: error: invalid conversion from 'long long int*' to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   21 |                     a.pb(mn); a.pb(mx);
      |                                    ^~
      |                                    |
      |                                    long long int*
gap.cpp:22:28: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   22 |                     hi = mx-1; lo = mn+1;
      |                          ~~^~
      |                            |
      |                            long long int*
gap.cpp:22:39: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   22 |                     hi = mx-1; lo = mn+1;
      |                                     ~~^~
      |                                       |
      |                                       long long int*