Submission #489784

#TimeUsernameProblemLanguageResultExecution timeMemory
489784marcoskalGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> 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); long long ans=step, cntr=0; for(int i=first;i<=last+1;i+=ans) { //cout<<i+1<<" "<<i+step<<" "<<endl; MinMax(i+1, i+ans, &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 /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: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: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/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~