이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<cmath>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<cstdio>
#include<bitset>
#include<chrono>
#include<random>
#include<ext/rope>
/* ordered_set
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int maxN = 1e5 + 5;
const int mod = 1e9 + 7;
const ll oo = 1e18;
ll a[maxN];
ll findGap(int T, int n)
{
if(T == 1)
{
int low = 1, high = n;
a[n + 1] = (ll)2e18 + 1;
while(low <= high)
{
MinMax(a[low - 1] + 1, a[high + 1] - 1, &a[low], &a[high]);
low++;
high--;
}
ll res = 0;
for(int i=2; i<=n; i++)
res = max(res, abs(a[i] - a[i - 1]));
return res;
}
ll res = 0;
MinMax(0, oo, &a[1], &a[n]);
ll pre = a[1];
ll h = (a[n] - a[1] + n - 2) / (n - 1);
h--;
ll now = a[1] + 1;
while(true)
{
ll p, q;
MinMax(now, now + h, &p, &q);
res = max(res, p - pre);
pre = max(pre, q);
now += h + 1;
if(q == a[n]) break;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |