Submission #629646

#TimeUsernameProblemLanguageResultExecution timeMemory
629646Cyber_WolfGap (APIO16_gap)C++14
0 / 100
25 ms1084 KiB
//Contest: APIO 16 Problem 3 //Problem Name: Gap #include <bits/stdc++.h> #include "gap.h" using namespace std; #define lg long long long long findGap(int subtask, int n) { vector<long long> v; long long first = 0, last = 1e18; while(v.size() < n) { long long mnm, mxm; MinMax(first, last, &mnm, &mxm); v.push_back(mnm); if(mnm != mxm) v.push_back(mxm); 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:16:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |  while(v.size() < n)
      |        ~~~~~~~~~^~~
gap.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int i = 1; i < v.size(); i++) ans = max(ans, v[i]-v[i-1]);
      |                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...