Submission #629648

#TimeUsernameProblemLanguageResultExecution timeMemory
629648Cyber_WolfGap (APIO16_gap)C++14
30 / 100
48 ms2260 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); first = mnm+1; last = mxm-1; } 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:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  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...