Submission #554162

#TimeUsernameProblemLanguageResultExecution timeMemory
554162QwertyPiGap (APIO16_gap)C++14
0 / 100
3097 ms1876 KiB
#include "gap.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; long long findGap(int T, int N) { ll L, R; MinMax(0, 1e18, &L, &R); ll tg = 1 + (R - L - 1) / (N - 1); set<ll> a; a.insert(L); a.insert(R); for(int i = L + 1; i < R; i += tg){ ll ll, rr; MinMax(i, min(R - 1, i + tg - 1), &ll, &rr); if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr); } ll ans = 0; for(auto it = a.begin(); it != a.end(); it++){ if(next(it) != a.begin()) ans = max(ans, *next(it) - *it); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:14:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   14 |   if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
      |   ^~
gap.cpp:14:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   14 |   if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
      |                              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...