Submission #534476

#TimeUsernameProblemLanguageResultExecution timeMemory
534476pokmui9909Gap (APIO16_gap)C++17
0 / 100
55 ms2320 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define x first #define y second pair<ll, ll> ask(ll s, ll e){ pair<ll, ll> p; MinMax(s, e, &p.x, &p.y); return p; } long long findGap(int T, int N){ vector<ll> A; ll L = 0, R = 1e18 + 5; while(N){ pair<ll, ll> r = ask(L, R); A.push_back(r.x); A.push_back(r.y); L = r.x + 1, R = r.y - 1; N -= 2; } sort(A.begin(), A.end()); ll ans = 0; for(int i = 0; i < A.size() - 1; i++){ ans = max(ans, A[i + 1] - A[i]); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:22: 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 = 0; i < A.size() - 1; i++){
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...