# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
835919 | BT21tata | Gap (APIO16_gap) | C++17 | 44 ms | 2264 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>
typedef long long ll;
#define pb push_back
using namespace std;
vector<ll>v;
ll mn, mx;
long long findGap(int T, int n)
{
if(T==1)
{
ll l=0, r=1e18, ret=0;
while(v.size()<n)
{
MinMax(l, r, &mn, &mx);
v.pb(mn); v.pb(mx);
l=mn+1; r=mx-1;
}
sort(v.begin(), v.end());
for(int i=1; i<(int)v.size(); i++)
ret=max(ret, v[i]-v[i-1]);
return ret;
}
MinMax(0, 1e18, &mn, &mx);
ll gap=(mx-mn-1)/(n-1)+1;
cout<<gap<<endl<<flush ;
ll l=mn, r=mx, last=l, ans=gap;
for(ll i=l; i<r; i+=gap)
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |