Submission #629642

#TimeUsernameProblemLanguageResultExecution timeMemory
629642Cyber_WolfGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
//Contest: APIO 16 Problem 3 //Problem Name: Gap #include <bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int subtask, int n) { vector<long long> v; lg x = 0; long long first = 0, last = 1e18; while(x < n) { long long mnm, mxm; MinMax(first, last, &mnm, &mxm); v.push_back(mnm); x++; if(mnm != mxm) v.push_back(mxm), x++; last = mnm+1; first = mxm-1; if(first >= last) break; } long long ans = 0; sort(v.begin(), v.end()); for(int i = 1; i < v.size(); i++) ans = max(ans, v[i]-v[i-1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:14:2: error: 'lg' was not declared in this scope; did you mean 'log'?
   14 |  lg x = 0;
      |  ^~
      |  log
gap.cpp:16:8: error: 'x' was not declared in this scope
   16 |  while(x < n)
      |        ^
gap.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = 1; i < v.size(); i++) ans = max(ans, v[i]-v[i-1]);
      |                 ~~^~~~~~~~~~