Submission #295871

#TimeUsernameProblemLanguageResultExecution timeMemory
295871dCodingGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long void MinMax(ll s, ll t, ll& a, ll& b); ll findGap(int t, int n) { ll lo = 0, hi = 1e18; vector<ll> l,h; ll mn = 0,mx = 0; while(l.size()+h.size() < n) { MinMax(lo,hi,&mn,&mx); if(mn == mx) { l.push_back(mn); } else { l.push_back(mn); h.push_back(mx); } lo = mn; hi = mx; } ll ans = 0; for(int i=1;i<l.size();i++) ans = max(ans, l[i]-l[i-1]); for(int i=1;i<h.size();i++) ans = max(ans, h[i]-h[i-1]); ans = max(ans, h[0]-l.back()); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:26: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |  while(l.size()+h.size() < n) {
      |        ~~~~~~~~~~~~~~~~~~^~~
gap.cpp:11:16: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   11 |   MinMax(lo,hi,&mn,&mx);
      |                ^~~
      |                |
      |                long long int*
gap.cpp:5:29: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int&, long long int&)'
    5 | void MinMax(ll s, ll t, ll& a, ll& b);
      |                             ^
gap.cpp:11:16: error: cannot bind rvalue '(long long int)(& mn)' to 'long long int&'
   11 |   MinMax(lo,hi,&mn,&mx);
      |                ^~~
gap.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i=1;i<l.size();i++) ans = max(ans, l[i]-l[i-1]);
      |              ~^~~~~~~~~
gap.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int i=1;i<h.size();i++) ans = max(ans, h[i]-h[i-1]);
      |              ~^~~~~~~~~