Submission #266592

#TimeUsernameProblemLanguageResultExecution timeMemory
266592dCodingGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <vector> #include <algorithm> using namespace std; long long findGap(int T, int N) { vector<ll> a; ll lo = 0, hi = 1e18; while(a.size() < N) { ll mn,mx; 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:8:12: error: 'll' was not declared in this scope
    8 |     vector<ll> a;
      |            ^~
gap.cpp:8:14: error: template argument 1 is invalid
    8 |     vector<ll> a;
      |              ^
gap.cpp:8:14: error: template argument 2 is invalid
gap.cpp:9:7: error: expected ';' before 'lo'
    9 |     ll lo = 0, hi = 1e18;
      |       ^~~
      |       ;
gap.cpp:10:13: error: request for member 'size' in 'a', which is of non-class type 'int'
   10 |     while(a.size() < N) {
      |             ^~~~
gap.cpp:11:11: error: expected ';' before 'mn'
   11 |         ll mn,mx;
      |           ^~~
      |           ;
gap.cpp:12:16: error: 'lo' was not declared in this scope
   12 |         MinMax(lo,hi,mn,mx);
      |                ^~
gap.cpp:12:19: error: 'hi' was not declared in this scope
   12 |         MinMax(lo,hi,mn,mx);
      |                   ^~
gap.cpp:12:22: error: 'mn' was not declared in this scope
   12 |         MinMax(lo,hi,mn,mx);
      |                      ^~
gap.cpp:12:25: error: 'mx' was not declared in this scope
   12 |         MinMax(lo,hi,mn,mx);
      |                         ^~
gap.cpp:14:15: error: request for member 'pb' in 'a', which is of non-class type 'int'
   14 |             a.pb(mn);
      |               ^~
gap.cpp:16:15: error: request for member 'pb' in 'a', which is of non-class type 'int'
   16 |             a.pb(mn); a.pb(mx);
      |               ^~
gap.cpp:16:25: error: request for member 'pb' in 'a', which is of non-class type 'int'
   16 |             a.pb(mn); a.pb(mx);
      |                         ^~
gap.cpp:18:13: error: 'assert' was not declared in this scope
   18 |             assert(lo <= hi);
      |             ^~~~~~
gap.cpp:4:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    3 | #include <algorithm>
  +++ |+#include <cassert>
    4 | using namespace std;
gap.cpp:21:7: error: expected ';' before 'ans'
   21 |     ll ans = 0;
      |       ^~~~
      |       ;
gap.cpp:22:12: error: request for member 'begin' in 'a', which is of non-class type 'int'
   22 |     sort(a.begin(),a.end());
      |            ^~~~~
gap.cpp:22:22: error: request for member 'end' in 'a', which is of non-class type 'int'
   22 |     sort(a.begin(),a.end());
      |                      ^~~
gap.cpp:23:9: error: 'i' was not declared in this scope
   23 |     FOR(i,1,n-1) ans = max(ans,a[i]-a[i-1]);
      |         ^
gap.cpp:23:13: error: 'n' was not declared in this scope
   23 |     FOR(i,1,n-1) ans = max(ans,a[i]-a[i-1]);
      |             ^
gap.cpp:23:5: error: 'FOR' was not declared in this scope
   23 |     FOR(i,1,n-1) ans = max(ans,a[i]-a[i-1]);
      |     ^~~
gap.cpp:24:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     return ans;
      |            ^~~
      |            abs