# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
400586 | A_D | Gap (APIO16_gap) | C++14 | 56 ms | 2248 KiB |
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 "gap.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int m;
ll s()
{
vector<ll> vec;
ll l=0,r=1e18;
ll l2=0,r2=1e18;
ll *l1=&l2;
ll *r1=&r2;
while(l<=r&&m--){
MinMax(l,r,l1,r1);
if(l2!=-1)vec.push_back(l2);
if(r2!=-1)vec.push_back(r2);
l=l2;
r=r2;
l++;
r--;
}
sort(vec.begin(),vec.end());
ll ans=1;
for(ll i=1;i<vec.size();i++)ans=max(ans,vec[i]-vec[i-1]);
return ans;
}
long long findGap(int T, int N)
{
m=(N+1)/2;
if(T==1)return s();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |