Submission #22997

#TimeUsernameProblemLanguageResultExecution timeMemory
22997kdh9949Gap (APIO16_gap)C++14
0 / 100
93 ms7460 KiB
#include "gap.h" #include <algorithm> using namespace std; typedef long long ll; vector<ll> v; ll a = 0, b = (1LL << 62), c, x, y, ans; ll findGap(int T, int N) { if(T == 1){ for(int i = 0; i < (N + 1) / 2; i++){ MinMax(a, b, &a, &b); v.push_back(a); v.push_back(b); } } else{ MinMax(a, b, &a, &b); c = b - a; N--; for(int i = 0; i < N; i++){ MinMax(a + c / N * i + 1, a + c / N * (i + 1), &x, &y); v.push_back(x); v.push_back(y); } } 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 'll findGap(int, int)':
gap.cpp:26:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  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...