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 "gap.h"
using namespace std;
#define LL long long
#define F first
#define S second
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
const int M = 2e3+10;
const LL INF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;
const double PI = 3.141592653589793;
long long findGap(int T, int N)
{
LL l1 = 0,r1 = LINF+1;
LL *l = &l1,*r = &r1;
LL cur = 0;
vector<LL>vec;
for(int i=1;i<=(N+1)/2;i++){
MinMax(l1+1,r1-1,l,r);
if(*l!=*r)vec.push_back(*l),vec.push_back(*r);
else vec.push_back(*r);
}
sort(vec.begin(),vec.end());
LL mx = 0;
for(int i=0;i<vec.size()-1;i++)
mx = max(mx,vec[i+1]-vec[i]);
return mx;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:35:15: 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=0;i<vec.size()-1;i++)
| ~^~~~~~~~~~~~~
gap.cpp:22:5: warning: unused variable 'cur' [-Wunused-variable]
22 | LL cur = 0;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |