Submission #142966

#TimeUsernameProblemLanguageResultExecution timeMemory
142966shayan_pGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
// only miss the sun when it starts to snow #include<bits/stdc++.h> #define F first #define S second #define PB push_back #define sz(s) int((s).size()) #define bit(n,k) (((n)>>(k))&1) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll inf=1e18; vector<ll> v1, v2, vec; ll findGap(int t,int n){ ll ans=-1; if(t==1){ ll l=0, r=inf; while(l<=r){ ll f,s; MinMax(l,r,f,s); if(f==s) v1.PB(f); else v1.PB(f), v2.PB(s); l=f+1, r=s-1; } vec=v1; reverse(v2.begin(), v2.end()); for(ll x:v2) vec.PB(x); } else{ ll l,r; MinMax(0,inf,l,r); ll X=r-l, Y=X/(n-1); ans= (X+(n-2)) / (n-1); for(int i=0;i<n;i++){ v1.PB(l + Y*i); } int cnt=r-v1.back(); for(int i=n-1;i>=0;i--){ v1[i]+=cnt; if(cnt>0) cnt--; } for(int i=1;i<n;i++){ ll a,b; MinMax(v1[i-1],v1[i],a,b); if(a!=-1) vec.PB({a,b}); } } for(int i=1;i<sz(vec);i++){ ans=max(ans, vec[i] - vec[i-1]); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:26:14: error: 'MinMax' was not declared in this scope
      ll f,s; MinMax(l,r,f,s);
              ^~~~~~
gap.cpp:26:14: note: suggested alternative: 'rindex'
      ll f,s; MinMax(l,r,f,s);
              ^~~~~~
              rindex
gap.cpp:36:10: error: 'MinMax' was not declared in this scope
  ll l,r; MinMax(0,inf,l,r);
          ^~~~~~
gap.cpp:36:10: note: suggested alternative: 'rindex'
  ll l,r; MinMax(0,inf,l,r);
          ^~~~~~
          rindex
gap.cpp:49:28: error: no matching function for call to 'std::vector<long long int>::push_back(<brace-enclosed initializer list>)'
      if(a!=-1) vec.PB({a,b});
                            ^
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from gap.cpp:3:
/usr/include/c++/7/bits/stl_vector.h:939: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]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const long long int&}'
/usr/include/c++/7/bits/stl_vector.h:953: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]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<long long int>::value_type&& {aka long long int&&}'