Submission #502964

#TimeUsernameProblemLanguageResultExecution timeMemory
502964dooweyGap (APIO16_gap)C++14
70 / 100
67 ms3184 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair long long findGap(int T, int N){ ll low=0, high=0; ll lim = (ll)1e18; MinMax(0ll, lim, &low, &high); ll S = (high - low + (N - 1) - 1) / (N - 1); // the gap is atleast S ll gl = low + 1; ll gr; vector<ll> in; in.push_back(low); if(N >= 3){ ll ca, cb; while(gl <= high){ gr = min(high - 1, gl + S); MinMax(gl, gr, &ca, &cb); gl += S + 1; if(ca == -1) continue; in.push_back(ca); in.push_back(cb); } } in.push_back(high); ll res = 0; for(int i = 1; i < in.size(); i ++ ){ res = max(res, in[i] - in[i - 1]); } return res; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for(int i = 1; i < in.size(); i ++ ){
      |                    ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...