Submission #672270

#TimeUsernameProblemLanguageResultExecution timeMemory
672270Dan4LifeGap (APIO16_gap)C++17
0 / 100
46 ms2240 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
//#define int long long
using ll = long long;
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
#define sz(a) (int)a.size()
const int maxn = 5e5+10;
const ll LINF = (ll)2e18;


long long findGap(int T, int N)
{
	ll s=0, t=LINF,mn,mx,ans=0; 
	vector<ll> v; v.clear();
	while(1){
		MinMax(s,t,&mn,&mx); 
		if(mn!=-1) v.pb(mn); 
		if(mn>=mx or mn==-1) break; v.pb(mx);
		s=mn+1,t=mx-1;
	}
	sort(all(v));
	for(int i = 0; i < sz(v)-1; i++) ans = max(ans, v[i+1]-v[i]);
	return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:22:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   22 |   if(mn>=mx or mn==-1) break; v.pb(mx);
      |   ^~
gap.cpp:22:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   22 |   if(mn>=mx or mn==-1) break; v.pb(mx);
      |                               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...