| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1091033 | Nurislam | Gap (APIO16_gap) | C++17 | 3062 ms | 2448 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 <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#include "gap.h"
typedef long long ll;
vector<ll> a;
void solve1(ll l, ll r, int n){
ll lf = 1, rf = 1;
MinMax(l, r, &lf, &rf);
cout << lf << ' ' << rf << '\n';
if(lf == -1)return;
a.pb(lf);
if(lf != rf)a.pb(rf);
if(lf == rf || a.size() >= n)return;
l = lf + 1;
r = rf - 1;
ll len = sqrt(r-l)+1;
ll last = l;
while(last <= r){
solve1(last, min(last + len, r), n);
last += len + 1;
}
}
long long findGap(int t, int n)
{
solve1(0, 1e18, n);
sort(all(a));
ll ans = 1;
for(int i = 1; i < a.size(); i++)
ans = max(ans, a[i] - a[i-1]);
return ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
