This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//#include "grader.cpp"
#include "gap.h"
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define lol long long
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((lol)(1e15+100))
#define MX ((lol)(4e9+100))
#define ARRS ((lol)(1e6+100))
#define MOD ((lol)(1e9+7))
#define EP ((double)(1e-9))
#define EPS ((double)(1e-8))
#define pb push_back
#define PI ((double)3.141592653)
#define LG 21
long long findGap(int T, int n)
{
vector<ll> v;
ll k,p;
MinMax(0,1e18,&k,&p);
v.pb(k);
v.pb(p);
if(n>2){
ll l=k+1,r=p-1;
ll t=(r-l+2)/(n-1);
t=max(t,1ll);
for(ll i=l; i<=r; i+=t){
MinMax(i,min(r,i+t-1),&k,&p);
if(k<0)continue;
v.pb(k);
v.pb(p);
}
}
sort(v.begin(),v.end());
ll pas=0;
for(int i=1; i<v.size(); i++)
pas=max(pas,v[i]-v[i-1]);
return pas;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:49:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1; i<v.size(); i++)
~^~~~~~~~~
gap.cpp:49:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(int i=1; i<v.size(); i++)
^~~
gap.cpp:51:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
return pas;
^~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |