답안 #256856

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
256856 2020-08-03T09:51:50 Z Goolakh Gap (APIO16_gap) C++17
100 / 100
79 ms 1912 KB
// FUCKED UP FUCKED UP FUCKED UP FUCKED UP FUCKED UP
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=1e5+10, maxm=5e4+10, lg=21, mod=998244353, inf=1e18;

const ll MN=0,MX=inf;

ll ret=MN,a[maxn];
 
ll findGap(int T,int n){
	if(T==1){
		ll L=MN,R=MX,k=0;
		for(int i=n;i>0;i-=2){
			MinMax(L,R,&a[k],&a[n-1-k]);
			L=a[k]+1, R=a[n-1-k]-1;
			k++;
		}
		for(int i=1;i<n;i++) ret=max(ret,a[i]-a[i-1]);
	}
	else{
		ll lf,ri,gap;
		MinMax(MN,MX,&lf,&ri);
		gap=ret=(ri-lf+n-2)/(n- 1);
		ll pr=-1;
		for(ll i=lf;i<=ri;i+=gap+1){
			ll t1,t2;
			MinMax(i,min(i+gap,ri),&t1,&t2);
			if(t1!=-1){
				if(pr!=-1) ret=max(ret,t1-pr);
				pr=t2;
			}
		}
	}
	return ret;
}


/*
int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	
	
	return 0;
}
*/


 
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 13 ms 696 KB Output is correct
17 Correct 12 ms 748 KB Output is correct
18 Correct 13 ms 768 KB Output is correct
19 Correct 17 ms 768 KB Output is correct
20 Correct 9 ms 768 KB Output is correct
21 Correct 71 ms 1912 KB Output is correct
22 Correct 62 ms 1880 KB Output is correct
23 Correct 58 ms 1912 KB Output is correct
24 Correct 70 ms 1896 KB Output is correct
25 Correct 49 ms 1912 KB Output is correct
26 Correct 56 ms 1912 KB Output is correct
27 Correct 48 ms 1912 KB Output is correct
28 Correct 49 ms 1912 KB Output is correct
29 Correct 48 ms 1880 KB Output is correct
30 Correct 37 ms 1912 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 16 ms 512 KB Output is correct
17 Correct 16 ms 512 KB Output is correct
18 Correct 18 ms 512 KB Output is correct
19 Correct 15 ms 512 KB Output is correct
20 Correct 8 ms 512 KB Output is correct
21 Correct 67 ms 1080 KB Output is correct
22 Correct 71 ms 1152 KB Output is correct
23 Correct 79 ms 1152 KB Output is correct
24 Correct 73 ms 1144 KB Output is correct
25 Correct 57 ms 1144 KB Output is correct
26 Correct 67 ms 1144 KB Output is correct
27 Correct 65 ms 1144 KB Output is correct
28 Correct 65 ms 1144 KB Output is correct
29 Correct 78 ms 1164 KB Output is correct
30 Correct 38 ms 1152 KB Output is correct
31 Correct 0 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct