Submission #142707

#TimeUsernameProblemLanguageResultExecution timeMemory
142707HellAngelGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #include "gap.h" long long findGap(int T, int N) { int ans = 0; if(T == 1) { int mx, my; vector<int> vt = {}; int l = 0; int r = LLONG_MAX; while(true) { MinMax(l, r, &mx, &my); if(mx == my) { vt.push_back(mx); break; } if(mx == -1) { break; } vt.push_back(mx); vt.push_back(my); l = mx + 1; r = my - 1; } sort(vt.begin(), vt.end()); for(int i = 1; i < vt.size(); i++) { ans = max(ans, vt[i] - vt[i - 1]); } } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(long long int, long long int)':
gap.cpp:11:9: error: 'vector' was not declared in this scope
         vector<int> vt = {};
         ^~~~~~
gap.cpp:11:9: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
gap.cpp:2:13: error: expected primary-expression before 'long'
 #define int long long
             ^
gap.cpp:11:16: note: in expansion of macro 'int'
         vector<int> vt = {};
                ^~~
gap.cpp:19:17: error: 'vt' was not declared in this scope
                 vt.push_back(mx);
                 ^~
gap.cpp:26:13: error: 'vt' was not declared in this scope
             vt.push_back(mx);
             ^~
gap.cpp:31:14: error: 'vt' was not declared in this scope
         sort(vt.begin(), vt.end());
              ^~
gap.cpp:31:9: error: 'sort' was not declared in this scope
         sort(vt.begin(), vt.end());
         ^~~~
gap.cpp:31:9: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:4856:5: note:   'std::sort'
     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^~~~
gap.cpp:34:19: error: 'max' was not declared in this scope
             ans = max(ans, vt[i] - vt[i - 1]);
                   ^~~
gap.cpp:34:19: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~