Submission #629892

#TimeUsernameProblemLanguageResultExecution timeMemory
629892hy_1Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> #define ll long long long long findGap(int T, int N){ ll n = N; vector<ll> arr(n); ll l =1 , r = 1e18; while(arr.size() < n){ ll mn , mx; MinMax(l , r , mn , mx); arr.push_back(mn); if(mn != mx){ arr.push_back(mx); } l += 1; r -= 1; } ll ans = 0; for(int i =0; i<n-1; i++){ ll y = arr[i+1] - arr[i]; // ans = max(ans , y); if(y > ans) ans = y; } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    9 |  vector<ll> arr(n);
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
gap.cpp:5:12: error: expected primary-expression before 'long'
    5 | #define ll long long
      |            ^~~~
gap.cpp:9:9: note: in expansion of macro 'll'
    9 |  vector<ll> arr(n);
      |         ^~
gap.cpp:11:8: error: 'arr' was not declared in this scope
   11 |  while(arr.size() < n){
      |        ^~~
gap.cpp:13:18: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |   MinMax(l , r , mn , mx);
      |                  ^~
      |                  |
      |                  long long int
In file included from gap.cpp:1:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:13:23: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |   MinMax(l , r , mn , mx);
      |                       ^~
      |                       |
      |                       long long int
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:24:11: error: 'arr' was not declared in this scope
   24 |   ll y  = arr[i+1] - arr[i];
      |           ^~~