Submission #284864

#TimeUsernameProblemLanguageResultExecution timeMemory
284864triplem5dsGap (APIO16_gap)C++14
30 / 100
59 ms3228 KiB
#include "gap.h" #include "bits/stdc++.h" using namespace std; long long findGap(int T, int N) { long long ans = 0; if(T == 1){ vector<long long> L, R; long long LO = 0, HI = 1000000000000000000; long long * mn = &LO, *mx = &HI; while(L.size() + R.size() < N){ MinMax(LO,HI, mn, mx); L.push_back(*mn); R.push_back(*mx); LO = *mn + 1; HI = *mx - 1; } reverse(R.begin(),R.end()); if(N & 1) L.pop_back(); vector<long long> v; for(auto x : L)v.push_back(x); for(auto x : R)v.push_back(x); 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:12:31: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |     while(L.size() + R.size() < N){
      |           ~~~~~~~~~~~~~~~~~~~~^~~
gap.cpp:29:23: 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++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...