Submission #875384

# Submission time Handle Problem Language Result Execution time Memory
875384 2023-11-19T12:27:13 Z ZeroCool Gap (APIO16_gap) C++14
30 / 100
33 ms 3096 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

//#define int long long

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

using ll = long long;
using ld = long double;

const int N = 1e5 + 5;
const int M = 405;
const int SQRT = 500;
const int LOG = 20;
const ll INF = 1e18;
const int MOD = 1e9+7;
const ld EPS = 1e-9;

ll findGap(int t, int n){
	ll a ,b;
	MinMax(0, INF, &a, &b);
	if(t == 1){
		if(n == 2)return b - a;

		ll l = a;
		ll r = b;
		ll ans = -INF;
		for(int i = 0;i<(n - 1) / 2;i++){
			MinMax(l+1, r-1, &a, &b);
			ans = max(ans, a - l);
			ans = max(ans, r - b);
			l = a;
			r = b;
		}

		return ans;
	}

	ll l = a + 1;
	ll r = b;
	ll p = a;
	ll f = -INF;
	ll sz = (b - a ) / N;
	f = sz;
	while (l < r) {
		int z = min(r, l + sz);
		MinMax(l, z, &a, &b);
		l = z + 1;
		f = max(f, a - p);
		if (b != -1) p = b;
	}
	return f;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 2504 KB Output is correct
14 Correct 1 ms 2440 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 8 ms 2568 KB Output is correct
17 Correct 8 ms 2592 KB Output is correct
18 Correct 8 ms 2584 KB Output is correct
19 Correct 8 ms 2840 KB Output is correct
20 Correct 6 ms 2576 KB Output is correct
21 Correct 29 ms 2860 KB Output is correct
22 Correct 29 ms 2852 KB Output is correct
23 Correct 30 ms 2868 KB Output is correct
24 Correct 29 ms 2860 KB Output is correct
25 Correct 27 ms 2848 KB Output is correct
26 Correct 32 ms 3016 KB Output is correct
27 Correct 33 ms 2852 KB Output is correct
28 Correct 29 ms 2856 KB Output is correct
29 Correct 29 ms 2860 KB Output is correct
30 Correct 24 ms 2852 KB Output is correct
31 Correct 0 ms 2392 KB Output is correct
32 Correct 0 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Partially correct 3 ms 2392 KB Partially correct
6 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
7 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Partially correct 4 ms 2392 KB Partially correct
11 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
15 Runtime error 6 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 4 ms 2712 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 2780 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 2696 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2584 KB Execution failed because the return code was nonzero
20 Partially correct 13 ms 2556 KB Partially correct
21 Runtime error 14 ms 2832 KB Execution failed because the return code was nonzero
22 Runtime error 14 ms 2852 KB Execution failed because the return code was nonzero
23 Runtime error 14 ms 3096 KB Execution failed because the return code was nonzero
24 Runtime error 14 ms 2748 KB Execution failed because the return code was nonzero
25 Runtime error 12 ms 2848 KB Execution failed because the return code was nonzero
26 Runtime error 16 ms 2860 KB Execution failed because the return code was nonzero
27 Runtime error 14 ms 2864 KB Execution failed because the return code was nonzero
28 Runtime error 14 ms 2832 KB Execution failed because the return code was nonzero
29 Runtime error 18 ms 3028 KB Execution failed because the return code was nonzero
30 Correct 23 ms 2864 KB Output is correct
31 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero