답안 #1011661

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011661 2024-07-01T03:45:04 Z ezzzay Gap (APIO16_gap) C++14
100 / 100
44 ms 5008 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int MN=2e6;
ll arr[MN];
long long findGap(int T, int N){
	if(T==1){
int l=0,r=N-1;
	ll s=0,t=1e18;
	while(1){
		ll mn,mx;
		MinMax(s,t,&mn,&mx);
		arr[l]=mn;
		arr[r]=mx;
		s=mn+1;
		t=mx-1;

		if(l+1==r or l==r)break;
		l++;
		r--;
		
	}
	ll ans=0;
	for(int i=1;i<N;i++){
		ans=max(ans,arr[i]-arr[i-1]);
	}
	return ans;
	}
	else{
		ll mn,mx;
		MinMax(0,1e18,&mn,&mx);
		ll k=(mx-mn+N-2)/(N-1);
		ll ans=k,x,y,l=mn,i;
		for(i=mn;i<mx-k;i+=k+1){
			MinMax(i,i+k,&x,&y);
			if(x!=-1){
				ans=max(ans,x-l);
				l=y;
			}
		}
		MinMax(i,mx,&x,&y);
		if(x!=-1)ans=max(ans,x-l);
		return ans;

	}
	return 1;
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2392 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 0 ms 2392 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 0 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 6 ms 4792 KB Output is correct
17 Correct 6 ms 4680 KB Output is correct
18 Correct 6 ms 4696 KB Output is correct
19 Correct 7 ms 4644 KB Output is correct
20 Correct 5 ms 4696 KB Output is correct
21 Correct 29 ms 4952 KB Output is correct
22 Correct 32 ms 4952 KB Output is correct
23 Correct 25 ms 4952 KB Output is correct
24 Correct 23 ms 4880 KB Output is correct
25 Correct 24 ms 4952 KB Output is correct
26 Correct 29 ms 4952 KB Output is correct
27 Correct 26 ms 5008 KB Output is correct
28 Correct 24 ms 4952 KB Output is correct
29 Correct 21 ms 4952 KB Output is correct
30 Correct 18 ms 4952 KB Output is correct
31 Correct 0 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2392 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 9 ms 2392 KB Output is correct
17 Correct 8 ms 2488 KB Output is correct
18 Correct 8 ms 2392 KB Output is correct
19 Correct 8 ms 2392 KB Output is correct
20 Correct 5 ms 2392 KB Output is correct
21 Correct 32 ms 2740 KB Output is correct
22 Correct 34 ms 2648 KB Output is correct
23 Correct 33 ms 2648 KB Output is correct
24 Correct 39 ms 2692 KB Output is correct
25 Correct 30 ms 2648 KB Output is correct
26 Correct 44 ms 2648 KB Output is correct
27 Correct 40 ms 2648 KB Output is correct
28 Correct 34 ms 2648 KB Output is correct
29 Correct 33 ms 2648 KB Output is correct
30 Correct 26 ms 2648 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct