Submission #142709

#TimeUsernameProblemLanguageResultExecution timeMemory
142709HellAngelGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
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 < (int)vt.size(); i++) { ans = max(ans, vt[i] - vt[i - 1]); } } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:7:9: error: 'vector' was not declared in this scope
         vector<int> vt = {};
         ^~~~~~
gap.cpp:7:16: error: expected primary-expression before 'int'
         vector<int> vt = {};
                ^~~
gap.cpp:9:17: error: 'LLONG_MAX' was not declared in this scope
         int r = LLONG_MAX;
                 ^~~~~~~~~
gap.cpp:9:17: note: suggested alternative: '__LONG_MAX__'
         int r = LLONG_MAX;
                 ^~~~~~~~~
                 __LONG_MAX__
gap.cpp:12:13: error: 'MinMax' was not declared in this scope
             MinMax(l, r, &mx, &my);
             ^~~~~~
gap.cpp:15:17: error: 'vt' was not declared in this scope
                 vt.push_back(mx);
                 ^~
gap.cpp:22:13: error: 'vt' was not declared in this scope
             vt.push_back(mx);
             ^~
gap.cpp:27:14: error: 'vt' was not declared in this scope
         sort(vt.begin(), vt.end());
              ^~
gap.cpp:27:9: error: 'sort' was not declared in this scope
         sort(vt.begin(), vt.end());
         ^~~~
gap.cpp:27:9: note: suggested alternative: 'short'
         sort(vt.begin(), vt.end());
         ^~~~
         short
gap.cpp:30:19: error: 'max' was not declared in this scope
             ans = max(ans, vt[i] - vt[i - 1]);
                   ^~~
gap.cpp:30:19: note: suggested alternative: 'mx'
             ans = max(ans, vt[i] - vt[i - 1]);
                   ^~~
                   mx