| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 363147 | alireza_kaviani | Gap (APIO16_gap) | C++11 | 72 ms | 3444 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>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
long long findGap(int t, int n){
ll l , r , len , x;
MinMax(0 , INF , &l , &r);
len = r - l; x = (len + n - 2) / (n - 1);
vector<ll> ans = {l , r};
for(int i = 0 ; i < n - 1 ; i++){
ll ql = l + i * x , qr = l + (i + 1) * x;
ll ansl , ansr;
MinMax(ql , qr - 1 , &ansl , &ansr);
if(ansl == -1) continue;
ans.push_back(ansl);
ans.push_back(ansr);
}
sort(ans.begin() , ans.end());
ll res = 0;
for(int i = 0 ; i + 1 < ans.size() ; i++){
res = max(res , ans[i + 1] - ans[i]);
}
//cout << len << endl;
return res;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
