Submission #489781

#TimeUsernameProblemLanguageResultExecution timeMemory
489781marcoskalGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <vector> long long findGap(int T, int N) { long long first, last, first1, last1; MinMax(0, 1000000000000000001ll, &first, &last); long long step=(last-first)/(N-1); vector<long long> v; v.push_back(first); std::long long ans=step, cntr=0; for(int i=first;i<=last+1;i+=step) { //cout<<i+1<<" "<<i+step<<" "<<endl; MinMax(i+1, i+step, &first1, &last1); if(first1!=-1){ v.push_back(first1); cntr++; } if(last1!=-1&&last1!=first1){ v.push_back(last1); cntr++; } ans=max(ans, v[cntr]-v[cntr-1]); } //for(int i=0;i<v.size();i++) //cout<<v[i]<<" "; //cout<<endl; return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:4: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    9 |    vector<long long> v;
      |    ^~~~~~
      |    std::vector
In file included from /usr/include/c++/10/vector:67,
                 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:9:11: error: expected primary-expression before 'long'
    9 |    vector<long long> v;
      |           ^~~~
gap.cpp:10:4: error: 'v' was not declared in this scope
   10 |    v.push_back(first);
      |    ^
gap.cpp:11:9: error: expected unqualified-id before 'long'
   11 |    std::long long ans=step, cntr=0;
      |         ^~~~
gap.cpp:18:12: error: 'cntr' was not declared in this scope
   18 |            cntr++;
      |            ^~~~
gap.cpp:22:12: error: 'cntr' was not declared in this scope
   22 |            cntr++;
      |            ^~~~
gap.cpp:24:12: error: 'ans' was not declared in this scope
   24 |            ans=max(ans, v[cntr]-v[cntr-1]);
      |            ^~~
gap.cpp:24:27: error: 'cntr' was not declared in this scope
   24 |            ans=max(ans, v[cntr]-v[cntr-1]);
      |                           ^~~~
gap.cpp:24:16: error: 'max' was not declared in this scope; did you mean 'std::max'?
   24 |            ans=max(ans, v[cntr]-v[cntr-1]);
      |                ^~~
      |                std::max
In file included from /usr/include/c++/10/vector:60,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
gap.cpp:29:9: error: 'ans' was not declared in this scope
   29 |  return ans;
      |         ^~~