Submission #44712

# Submission time Handle Problem Language Result Execution time Memory
44712 2018-04-05T11:39:17 Z faustaadp Gap (APIO16_gap) C++17
100 / 100
100 ms 2584 KB
#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll ma,L,R,gm,i,LT,RT,a[101010];
vector<ll> v;
long long findGap(int T, int N)
{
	if(T==1)
	{
		LT=-1;
		RT=1e18;
		RT++;
		for(i=1;i<=(N+1)/2;i++)
		{
			MinMax(LT+1,RT-1,&LT,&RT);
			a[i]=LT;
			a[N-i+1]=RT;
		}
		for(i=2;i<=N;i++)
			ma=max(ma,a[i]-a[i-1]);
	}
	else
	{
		MinMax(0,(ll)1e18,&L,&R);
		gm=(R-L)/(N-1);
		for(i=L;i<R;i+=(gm+1))
		{
			MinMax(i,min(i+gm,R),&LT,&RT);
			if(LT!=-1)
				v.pb(LT);
			if(LT!=RT)
				v.pb(RT);
		}
		for(i=1;i<v.size();i++)
			ma=max(ma,v[i]-v[i-1]);
	}
	return ma;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=1;i<v.size();i++)
           ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 508 KB Output is correct
4 Correct 2 ms 508 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 2 ms 688 KB Output is correct
9 Correct 2 ms 688 KB Output is correct
10 Correct 2 ms 688 KB Output is correct
11 Correct 2 ms 688 KB Output is correct
12 Correct 3 ms 688 KB Output is correct
13 Correct 3 ms 712 KB Output is correct
14 Correct 3 ms 712 KB Output is correct
15 Correct 3 ms 712 KB Output is correct
16 Correct 16 ms 1040 KB Output is correct
17 Correct 16 ms 1040 KB Output is correct
18 Correct 22 ms 1040 KB Output is correct
19 Correct 17 ms 1040 KB Output is correct
20 Correct 11 ms 1040 KB Output is correct
21 Correct 59 ms 2172 KB Output is correct
22 Correct 56 ms 2172 KB Output is correct
23 Correct 62 ms 2172 KB Output is correct
24 Correct 56 ms 2264 KB Output is correct
25 Correct 48 ms 2264 KB Output is correct
26 Correct 57 ms 2264 KB Output is correct
27 Correct 56 ms 2264 KB Output is correct
28 Correct 56 ms 2264 KB Output is correct
29 Correct 57 ms 2264 KB Output is correct
30 Correct 41 ms 2264 KB Output is correct
31 Correct 2 ms 2264 KB Output is correct
32 Correct 2 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2264 KB Output is correct
2 Correct 2 ms 2264 KB Output is correct
3 Correct 2 ms 2264 KB Output is correct
4 Correct 2 ms 2264 KB Output is correct
5 Correct 2 ms 2264 KB Output is correct
6 Correct 2 ms 2264 KB Output is correct
7 Correct 2 ms 2264 KB Output is correct
8 Correct 2 ms 2264 KB Output is correct
9 Correct 2 ms 2264 KB Output is correct
10 Correct 2 ms 2264 KB Output is correct
11 Correct 3 ms 2264 KB Output is correct
12 Correct 3 ms 2264 KB Output is correct
13 Correct 3 ms 2264 KB Output is correct
14 Correct 3 ms 2264 KB Output is correct
15 Correct 3 ms 2264 KB Output is correct
16 Correct 20 ms 2264 KB Output is correct
17 Correct 26 ms 2264 KB Output is correct
18 Correct 20 ms 2264 KB Output is correct
19 Correct 20 ms 2264 KB Output is correct
20 Correct 15 ms 2264 KB Output is correct
21 Correct 78 ms 2564 KB Output is correct
22 Correct 83 ms 2564 KB Output is correct
23 Correct 83 ms 2564 KB Output is correct
24 Correct 77 ms 2564 KB Output is correct
25 Correct 74 ms 2564 KB Output is correct
26 Correct 79 ms 2564 KB Output is correct
27 Correct 100 ms 2564 KB Output is correct
28 Correct 78 ms 2584 KB Output is correct
29 Correct 83 ms 2584 KB Output is correct
30 Correct 40 ms 2584 KB Output is correct
31 Correct 2 ms 2584 KB Output is correct
32 Correct 2 ms 2584 KB Output is correct