Submission #35168

# Submission time Handle Problem Language Result Execution time Memory
35168 2017-11-18T14:24:26 Z cheater2k Gap (APIO16_gap) C++14
30 / 100
73 ms 5924 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n, sz;
long long a[N];
long long s = 0, t = 2e18;
long long mn, mx;

long long solve1() {
	for (int i = 1; i <= (n + 1) / 2; ++i) {
		if (s <= t) MinMax(s, t, &mn, &mx);
		a[i] = mn; a[n - i + 1] = mx;
		s = mn + 1, t = mx - 1;
	}
	sz = n;
}

long long solve2() {
	MinMax(0, 2e18, &s, &t);
	long long gap = (t - s + n - 2) / (n - 1);
	for (long long i = s; i <= t; i += gap + 1) {
		MinMax(i, i + gap, &mn, &mx);
		a[++sz] = mn;
		a[++sz] = mx;
	}
}

long long findGap(int T, int _N) {
	n = _N;
	if (T == 1) solve1();
	else solve2();

	long long ans = 0;
	sort(a + 1, a + sz + 1);
	for (int i = 2; i <= sz; ++i) ans = max(ans, a[i] - a[i-1]);
	return ans;
}

Compilation message

gap.cpp: In function 'long long int solve1()':
gap.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
gap.cpp: In function 'long long int solve2()':
gap.cpp:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5924 KB Output is correct
2 Correct 0 ms 5924 KB Output is correct
3 Correct 0 ms 5924 KB Output is correct
4 Correct 0 ms 5924 KB Output is correct
5 Correct 0 ms 5924 KB Output is correct
6 Correct 0 ms 5924 KB Output is correct
7 Correct 0 ms 5924 KB Output is correct
8 Correct 0 ms 5924 KB Output is correct
9 Correct 0 ms 5924 KB Output is correct
10 Correct 0 ms 5924 KB Output is correct
11 Correct 0 ms 5924 KB Output is correct
12 Correct 0 ms 5924 KB Output is correct
13 Correct 0 ms 5924 KB Output is correct
14 Correct 0 ms 5924 KB Output is correct
15 Correct 0 ms 5924 KB Output is correct
16 Correct 16 ms 5924 KB Output is correct
17 Correct 16 ms 5924 KB Output is correct
18 Correct 16 ms 5924 KB Output is correct
19 Correct 13 ms 5924 KB Output is correct
20 Correct 9 ms 5924 KB Output is correct
21 Correct 69 ms 5924 KB Output is correct
22 Correct 63 ms 5924 KB Output is correct
23 Correct 69 ms 5924 KB Output is correct
24 Correct 49 ms 5924 KB Output is correct
25 Correct 56 ms 5924 KB Output is correct
26 Correct 73 ms 5924 KB Output is correct
27 Correct 69 ms 5924 KB Output is correct
28 Correct 56 ms 5924 KB Output is correct
29 Correct 59 ms 5924 KB Output is correct
30 Correct 39 ms 5924 KB Output is correct
31 Correct 0 ms 5924 KB Output is correct
32 Correct 0 ms 5924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5924 KB Output is correct
2 Correct 0 ms 5924 KB Output is correct
3 Correct 0 ms 5924 KB Output is correct
4 Correct 0 ms 5924 KB Output is correct
5 Correct 0 ms 5924 KB Output is correct
6 Correct 0 ms 5924 KB Output is correct
7 Correct 0 ms 5924 KB Output is correct
8 Correct 0 ms 5924 KB Output is correct
9 Correct 0 ms 5924 KB Output is correct
10 Correct 0 ms 5924 KB Output is correct
11 Correct 0 ms 5924 KB Output is correct
12 Correct 0 ms 5924 KB Output is correct
13 Correct 0 ms 5924 KB Output is correct
14 Correct 0 ms 5924 KB Output is correct
15 Correct 0 ms 5924 KB Output is correct
16 Correct 19 ms 5924 KB Output is correct
17 Correct 19 ms 5924 KB Output is correct
18 Correct 16 ms 5924 KB Output is correct
19 Correct 19 ms 5924 KB Output is correct
20 Correct 9 ms 5924 KB Output is correct
21 Runtime error 49 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 56 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Incorrect 73 ms 5924 KB Output isn't correct
24 Runtime error 49 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 43 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 49 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 49 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 53 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 46 ms 5924 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Incorrect 36 ms 5924 KB Output isn't correct
31 Correct 0 ms 5924 KB Output is correct
32 Correct 0 ms 5924 KB Output is correct