Submission #1011660

# Submission time Handle Problem Language Result Execution time Memory
1011660 2024-07-01T03:44:36 Z ezzzay Gap (APIO16_gap) C++14
30 / 100
38 ms 5040 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-1)/(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;
	
}
# Verdict Execution time Memory 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 1 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 0 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 7 ms 4696 KB Output is correct
17 Correct 8 ms 4588 KB Output is correct
18 Correct 6 ms 4640 KB Output is correct
19 Correct 7 ms 4696 KB Output is correct
20 Correct 7 ms 4696 KB Output is correct
21 Correct 30 ms 5040 KB Output is correct
22 Correct 26 ms 4952 KB Output is correct
23 Correct 25 ms 4952 KB Output is correct
24 Correct 25 ms 4952 KB Output is correct
25 Correct 24 ms 4952 KB Output is correct
26 Correct 24 ms 4952 KB Output is correct
27 Correct 25 ms 4952 KB Output is correct
28 Correct 26 ms 4952 KB Output is correct
29 Correct 25 ms 4952 KB Output is correct
30 Correct 20 ms 4952 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 0 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB Output isn't 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 Incorrect 0 ms 2392 KB Output isn't correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 0 ms 2392 KB Output is correct
8 Correct 0 ms 2392 KB Output is correct
9 Correct 0 ms 2392 KB Output is correct
10 Correct 0 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 Incorrect 1 ms 2392 KB Output isn't correct
16 Correct 9 ms 2392 KB Output is correct
17 Correct 13 ms 2392 KB Output is correct
18 Correct 8 ms 2392 KB Output is correct
19 Correct 8 ms 2392 KB Output is correct
20 Correct 4 ms 2392 KB Output is correct
21 Correct 35 ms 2816 KB Output is correct
22 Correct 35 ms 2648 KB Output is correct
23 Correct 38 ms 2968 KB Output is correct
24 Correct 34 ms 2648 KB Output is correct
25 Incorrect 36 ms 2648 KB Output isn't correct
26 Correct 33 ms 2648 KB Output is correct
27 Correct 35 ms 2648 KB Output is correct
28 Correct 33 ms 2648 KB Output is correct
29 Correct 36 ms 2852 KB Output is correct
30 Correct 21 ms 2648 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct