Submission #42854

# Submission time Handle Problem Language Result Execution time Memory
42854 2018-03-05T14:02:43 Z fefe Gap (APIO16_gap) C++14
78.5412 / 100
95 ms 1516 KB
#include "gap.h"
#include<stack>
#include<stdio.h>
#define f MinMax
#define max(x,y) ((x)>(y)?(x):(y))
using namespace std;
long long findGap(int T, int N)
{
	long long s,e,ps,pe,maxx=0,x,y;
	if(T==1){
		f(0,(1LL<<62),&ps,&pe);
		N-=2;
		while(N>=2){
			f(ps+1,pe-1,&s,&e);
			N-=2;
			maxx=max(maxx,max(s-ps,pe-e));
			ps=s;pe=e;
		}
		if(N==1){
			f(ps+1,pe-1,&s,&e);
			return max(maxx,max(s-ps,pe-e));
		}
		return max(maxx,pe-ps);
	}
	f(0,(1LL<<62),&ps,&pe);
	x=(pe-ps)/N;
	if((pe-ps)%N)	x++;
	while(ps!=pe){
		y=ps;
		while(1){
			f(y+1,y+x,&s,&e);
			if(s!=-1)	break;
			y+=x;
		}
		maxx=max(maxx,s-ps);
		ps=e;
	}
	return maxx;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 1 ms 428 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 1 ms 520 KB Output is correct
7 Correct 1 ms 556 KB Output is correct
8 Correct 1 ms 556 KB Output is correct
9 Correct 1 ms 556 KB Output is correct
10 Correct 1 ms 556 KB Output is correct
11 Correct 2 ms 556 KB Output is correct
12 Correct 2 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 612 KB Output is correct
16 Correct 20 ms 748 KB Output is correct
17 Correct 18 ms 748 KB Output is correct
18 Correct 20 ms 748 KB Output is correct
19 Correct 14 ms 748 KB Output is correct
20 Correct 14 ms 752 KB Output is correct
21 Correct 53 ms 1388 KB Output is correct
22 Correct 53 ms 1388 KB Output is correct
23 Correct 55 ms 1388 KB Output is correct
24 Correct 54 ms 1388 KB Output is correct
25 Correct 48 ms 1388 KB Output is correct
26 Correct 56 ms 1388 KB Output is correct
27 Correct 72 ms 1516 KB Output is correct
28 Correct 54 ms 1516 KB Output is correct
29 Correct 56 ms 1516 KB Output is correct
30 Correct 46 ms 1516 KB Output is correct
31 Correct 1 ms 1516 KB Output is correct
32 Correct 1 ms 1516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1516 KB Output is correct
2 Partially correct 1 ms 1516 KB Partially correct
3 Partially correct 1 ms 1516 KB Partially correct
4 Partially correct 1 ms 1516 KB Partially correct
5 Partially correct 1 ms 1516 KB Partially correct
6 Partially correct 1 ms 1516 KB Partially correct
7 Partially correct 2 ms 1516 KB Partially correct
8 Partially correct 1 ms 1516 KB Partially correct
9 Partially correct 1 ms 1516 KB Partially correct
10 Partially correct 1 ms 1516 KB Partially correct
11 Partially correct 2 ms 1516 KB Partially correct
12 Partially correct 2 ms 1516 KB Partially correct
13 Partially correct 2 ms 1516 KB Partially correct
14 Partially correct 2 ms 1516 KB Partially correct
15 Partially correct 3 ms 1516 KB Partially correct
16 Partially correct 20 ms 1516 KB Partially correct
17 Partially correct 24 ms 1516 KB Partially correct
18 Partially correct 20 ms 1516 KB Partially correct
19 Partially correct 20 ms 1516 KB Partially correct
20 Correct 9 ms 1516 KB Output is correct
21 Partially correct 79 ms 1516 KB Partially correct
22 Partially correct 79 ms 1516 KB Partially correct
23 Partially correct 83 ms 1516 KB Partially correct
24 Partially correct 93 ms 1516 KB Partially correct
25 Partially correct 95 ms 1516 KB Partially correct
26 Partially correct 94 ms 1516 KB Partially correct
27 Partially correct 79 ms 1516 KB Partially correct
28 Partially correct 81 ms 1516 KB Partially correct
29 Partially correct 91 ms 1516 KB Partially correct
30 Correct 41 ms 1516 KB Output is correct
31 Partially correct 1 ms 1516 KB Partially correct
32 Partially correct 2 ms 1516 KB Partially correct