Submission #1076468

#TimeUsernameProblemLanguageResultExecution timeMemory
1076468s0urceGap (APIO16_gap)C++17
30 / 100
36 ms2736 KiB
#include "gap.h" #include <iostream> #include <vector> using namespace std; long long findGap(int T, int N) { vector<long long> a = {}; vector<long long> a_sec = {}; long long l = 0; long long r = 1e18; while (a.size() + a_sec.size() < N) { long long mn, mx; MinMax(l, r, &mn, &mx); if (mn == -1) break; a.push_back(mn); if (mn != mx) a_sec.push_back(mx); l = mn + 1; r = mx - 1; } for (int i = a_sec.size() - 1; i >= 0; i --) { a.push_back(a_sec[i]); } // for (auto aa: a) { // cout << aa << " "; // } // cout << endl; long long res = -1; for (int i = 0; i < N - 1; i ++) { res = max(res, a[i + 1] - a[i]); } return res; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:36: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |     while (a.size() + a_sec.size() < N) {
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...