Submission #1151245

#TimeUsernameProblemLanguageResultExecution timeMemory
1151245Theo830Gap (APIO16_gap)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9+7; const ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ii,ll> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training #include "gap.h" long long findGap(int T, int n){ ll ans = 1e18; vector<ll>arr; ll l = 0; f(i,0,n){ ll *a,*b; MinMax(l,l+1,a,b); arr.pb(a); l = (*a)+1; } f(i,1,n){ ans = min(ans,arr[i] - arr[i-1]); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:33:15: error: no matching function for call to 'push_back(ll*&)'
   33 |         arr.pb(a);
      |         ~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187: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)
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:33:16: error: invalid conversion from 'll*' {aka 'long long int*'} to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   33 |         arr.pb(a);
      |                ^
      |                |
      |                ll* {aka long long int*}
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1203: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)
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note:   conversion of argument 1 would be ill-formed:
gap.cpp:33:16: error: invalid conversion from 'll*' {aka 'long long int*'} to 'std::vector<long long int>::value_type' {aka 'long long int'} [-fpermissive]
   33 |         arr.pb(a);
      |                ^
      |                |
      |                ll* {aka long long int*}