Submission #24966

# Submission time Handle Problem Language Result Execution time Memory
24966 2017-06-19T11:45:06 Z gabrielsimoes Gap (APIO16_gap) C++14
0 / 100
73 ms 4904 KB
#include "gap.h"
#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long ll;
const ll MIn = 0, MAX = 1000000000000000000;

ll solve1(int n) {
	ll v[n+1];
	int i = 1, k = n;
	ll mn = MIn, mx = MAX;
	while (i <= k) {
		MinMax(mn, mx, v+i, v+k);
		mn = v[i++]+1;
		mx = v[k--]-1;
	}

	ll ret = 1;
	for (int i = 1; i < n; i++)
		ret = max(ret, v[i+1] - v[i]);
	return ret;
}

ll solve2(int n) {
	return solve1(n);
}

ll findGap(int t, int n)
{
	printf("%lld\n", t == 1 ? solve1(n) : solve2(n));
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:32:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4244 KB Expected EOF
2 Incorrect 0 ms 4244 KB Expected EOF
3 Incorrect 0 ms 4244 KB Expected EOF
4 Incorrect 0 ms 4244 KB Expected EOF
5 Incorrect 0 ms 4244 KB Expected EOF
6 Incorrect 0 ms 4244 KB Expected EOF
7 Incorrect 0 ms 4244 KB Expected EOF
8 Incorrect 0 ms 4244 KB Expected EOF
9 Incorrect 0 ms 4244 KB Expected EOF
10 Incorrect 0 ms 4244 KB Expected EOF
11 Incorrect 0 ms 4244 KB Expected EOF
12 Incorrect 0 ms 4244 KB Expected EOF
13 Incorrect 0 ms 4244 KB Expected EOF
14 Incorrect 0 ms 4244 KB Expected EOF
15 Incorrect 0 ms 4244 KB Expected EOF
16 Incorrect 19 ms 4312 KB Expected EOF
17 Incorrect 9 ms 4316 KB Expected EOF
18 Incorrect 13 ms 4312 KB Expected EOF
19 Incorrect 13 ms 4312 KB Expected EOF
20 Incorrect 6 ms 4316 KB Expected EOF
21 Incorrect 56 ms 4904 KB Expected EOF
22 Incorrect 56 ms 4904 KB Expected EOF
23 Incorrect 59 ms 4896 KB Expected EOF
24 Incorrect 49 ms 4900 KB Expected EOF
25 Incorrect 43 ms 4900 KB Expected EOF
26 Incorrect 73 ms 4896 KB Expected EOF
27 Incorrect 53 ms 4904 KB Expected EOF
28 Incorrect 49 ms 4896 KB Expected EOF
29 Incorrect 53 ms 4904 KB Expected EOF
30 Incorrect 39 ms 4904 KB Expected EOF
31 Incorrect 0 ms 4244 KB Expected EOF
32 Incorrect 0 ms 4244 KB Expected EOF
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4244 KB Expected EOF
2 Incorrect 0 ms 4244 KB Expected EOF
3 Incorrect 0 ms 4244 KB Expected EOF
4 Incorrect 0 ms 4244 KB Expected EOF
5 Incorrect 0 ms 4244 KB Expected EOF
6 Incorrect 0 ms 4244 KB Expected EOF
7 Incorrect 0 ms 4244 KB Expected EOF
8 Incorrect 0 ms 4244 KB Expected EOF
9 Incorrect 0 ms 4244 KB Expected EOF
10 Incorrect 0 ms 4244 KB Expected EOF
11 Incorrect 0 ms 4244 KB Expected EOF
12 Incorrect 0 ms 4244 KB Expected EOF
13 Incorrect 0 ms 4244 KB Expected EOF
14 Incorrect 0 ms 4244 KB Expected EOF
15 Incorrect 0 ms 4244 KB Expected EOF
16 Incorrect 13 ms 4316 KB Expected EOF
17 Incorrect 13 ms 4312 KB Expected EOF
18 Incorrect 19 ms 4312 KB Expected EOF
19 Incorrect 16 ms 4316 KB Expected EOF
20 Incorrect 13 ms 4312 KB Expected EOF
21 Incorrect 63 ms 4896 KB Expected EOF
22 Incorrect 53 ms 4900 KB Expected EOF
23 Incorrect 53 ms 4904 KB Expected EOF
24 Incorrect 63 ms 4904 KB Expected EOF
25 Incorrect 46 ms 4896 KB Expected EOF
26 Incorrect 63 ms 4896 KB Expected EOF
27 Incorrect 63 ms 4904 KB Expected EOF
28 Incorrect 49 ms 4900 KB Expected EOF
29 Incorrect 56 ms 4900 KB Expected EOF
30 Incorrect 33 ms 4896 KB Expected EOF
31 Incorrect 0 ms 4244 KB Expected EOF
32 Incorrect 0 ms 4244 KB Expected EOF