Submission #1029893

# Submission time Handle Problem Language Result Execution time Memory
1029893 2024-07-21T13:27:56 Z Muhammet Gap (APIO16_gap) C++17
70 / 100
48 ms 2856 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

#define ll long long
#define sz(s) (int)s.size()

ll findGap(int T, int n){
	ll s = 0, t = 1e18, mn, mx;
	MinMax(s, t, &mn, &mx);
	ll d = ((mx - mn + n - 2) / (n - 1)), k = mn, ans = d, m = mx, ind = 0;
	for(ll i = mn+1; i + d < m; i += (d + 1)){
		MinMax(i, i + d, &mn, &mx);
		if(mn != -1){
			ans = max(ans, mn-k);
		}
		if(mx != -1){
			k = mx;
		}
		ind = i;
	}

	ind += d;

	ll x;
	MinMax(ind+1,m-1,&mn,&x);
	if(mn != -1) ans = max(ans, mn-k);
	if(x == -1){
		ans = max(ans,m-k);
	}
	else {
		ans = max(ans,m-x);
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2416 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 0 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Incorrect 0 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 11 ms 2592 KB Output isn't correct
17 Incorrect 8 ms 600 KB Output isn't correct
18 Incorrect 8 ms 2392 KB Output isn't correct
19 Incorrect 8 ms 2392 KB Output isn't correct
20 Incorrect 7 ms 2392 KB Output isn't correct
21 Incorrect 33 ms 2648 KB Output isn't correct
22 Incorrect 34 ms 2648 KB Output isn't correct
23 Incorrect 35 ms 2648 KB Output isn't correct
24 Incorrect 31 ms 2648 KB Output isn't correct
25 Incorrect 33 ms 2808 KB Output isn't correct
26 Incorrect 40 ms 2632 KB Output isn't correct
27 Incorrect 43 ms 2856 KB Output isn't correct
28 Incorrect 31 ms 2648 KB Output isn't correct
29 Incorrect 38 ms 2732 KB Output isn't correct
30 Incorrect 19 ms 2648 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 0 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2392 KB Output is correct
4 Correct 1 ms 2388 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 0 ms 2392 KB Output is correct
10 Correct 1 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 2392 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 10 ms 2392 KB Output is correct
17 Correct 13 ms 2392 KB Output is correct
18 Correct 10 ms 2392 KB Output is correct
19 Correct 10 ms 2392 KB Output is correct
20 Correct 7 ms 2392 KB Output is correct
21 Correct 44 ms 2648 KB Output is correct
22 Correct 41 ms 2748 KB Output is correct
23 Correct 37 ms 2840 KB Output is correct
24 Correct 35 ms 2648 KB Output is correct
25 Correct 38 ms 2648 KB Output is correct
26 Correct 48 ms 2648 KB Output is correct
27 Correct 35 ms 2648 KB Output is correct
28 Correct 41 ms 2648 KB Output is correct
29 Correct 37 ms 2648 KB Output is correct
30 Correct 20 ms 2648 KB Output is correct
31 Correct 0 ms 2392 KB Output is correct
32 Correct 0 ms 2392 KB Output is correct