Submission #284900

#TimeUsernameProblemLanguageResultExecution timeMemory
284900triplem5dsGap (APIO16_gap)C++14
70 / 100
89 ms3308 KiB
#include "gap.h" #include "bits/stdc++.h" using namespace std; long long findGap(int T, int N) { long long mn, mx, ans = 0; MinMax(0, 1000000000000000000, &mn, &mx); long long d = (mx - mn + N - 3) / (N - 1); vector<long long> v({mn, mx}); long long cur = mn + 1; while(cur < v[1]) { MinMax(cur, min(v[1] - 1, cur + d - 1), &mn, &mx); cur += d; if(mn == -1)continue; v.push_back(mn); v.push_back(mx); } 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:29:22: 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...