Submission #295868

#TimeUsernameProblemLanguageResultExecution timeMemory
295868dCodingGap (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:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:8:2: error: 'vector' was not declared in this scope
    8 |  vector<ll> l,h;
      |  ^~~~~~
gap.cpp:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
gap.cpp:8:9: note: in expansion of macro 'll'
    8 |  vector<ll> l,h;
      |         ^~
gap.cpp:10:8: error: 'l' was not declared in this scope; did you mean 'lo'?
   10 |  while(l.size()+h.size() < n) {
      |        ^
      |        lo
gap.cpp:10:17: error: 'h' was not declared in this scope; did you mean 'hi'?
   10 |  while(l.size()+h.size() < n) {
      |                 ^
      |                 hi
gap.cpp:22:16: error: 'l' was not declared in this scope
   22 |  for(int i=1;i<l.size();i++) ans = max(ans, l[i]-l[i-1]);
      |                ^
gap.cpp:22:36: error: 'max' was not declared in this scope; did you mean 'mx'?
   22 |  for(int i=1;i<l.size();i++) ans = max(ans, l[i]-l[i-1]);
      |                                    ^~~
      |                                    mx
gap.cpp:23:16: error: 'h' was not declared in this scope
   23 |  for(int i=1;i<h.size();i++) ans = max(ans, h[i]-h[i-1]);
      |                ^
gap.cpp:23:36: error: 'max' was not declared in this scope; did you mean 'mx'?
   23 |  for(int i=1;i<h.size();i++) ans = max(ans, h[i]-h[i-1]);
      |                                    ^~~
      |                                    mx
gap.cpp:24:17: error: 'h' was not declared in this scope; did you mean 'hi'?
   24 |  ans = max(ans, h[0]-l.back());
      |                 ^
      |                 hi
gap.cpp:24:22: error: 'l' was not declared in this scope; did you mean 'lo'?
   24 |  ans = max(ans, h[0]-l.back());
      |                      ^
      |                      lo
gap.cpp:24:8: error: 'max' was not declared in this scope; did you mean 'mx'?
   24 |  ans = max(ans, h[0]-l.back());
      |        ^~~
      |        mx