| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1324411 | iamsazidh | Gap (APIO16_gap) | C++20 | 19 ms | 1380 KiB |
#include "gap.h"
//ᴇᴀᴄʜ ᴘᴇʀꜱᴏɴ ᴡɪʟʟ ᴏɴʟʏ ʜᴀᴠᴇ ᴡʜᴀᴛ ᴛʜᴇʏ ᴇɴᴅᴇᴀᴠᴏᴜʀᴇᴅ ᴛᴏᴡᴀʀᴅꜱ [53:39]
//Author: Sazid Hasan
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dl;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define spc " "
#ifdef ONLINE_JUDGE
#define debarr(array)
#define deb(x)
#define del
#else
#define debarr(array) for(int w = 0; w < array.size(); w++) cerr << #array << "-" << w << " = " << array[w] << endl;
#define deb(x) cerr << #x << " = " << x << endl;
#define del cerr << '\n';
#endif
const double PI = acos(-1);
const int MOD = 1000000007;
const int inf = (2147483647);
long long findGap(int T, int N)
{
ll ans = 1;
if(T==2){
ll st, end;
MinMax(1, 1e18, &st, &end);
ll len = end-st;
ll gap = (len+N-2)/(N-1);
ans = max(gap, ans);
vl arr = {st};
int ff = st+1, ss = st+1+gap;
ll one, two;
while(ff<=end){
if(ss>1e18) ss = 1e18;
MinMax(ff, ss, &one, &two);
if(one!=-1) arr.push_back(one);
if(two!=-1) arr.push_back(two);
ff += gap+1, ss += gap+1;
}
for(int i = 1; i < arr.size(); i++){
ans = max(ans, arr[i]-arr[i-1]);
}
}
return ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
