Submission #157591

# Submission time Handle Problem Language Result Execution time Memory
157591 2019-10-12T13:54:34 Z RoundMango Rice Hub (IOI11_ricehub) C++14
26 / 100
18 ms 1528 KB
#include <bits/stdc++.h>
using namespace std;
long long a[1000005], sum[1000005], n, l = 1, r, md, mx, xx, ans;
int besthub(int R, int L, int a[], long long b) {
	for (int i = 1; i <= R; i++) 
		sum[i] = sum[i-1] + a[i-1];
	r = R;
	while (l < r) {
		ans = 1e10;
		md = (l+r+1)>>1;
		for (int i = md; i <= R; i++) {
			n = i-md+1;
			mx = (i+n+1)>>1;
			xx = sum[i] - sum[mx] - (i-mx)*a[mx]  + a[mx]*(mx-n) - sum[mx-1] + sum[n-1];
			ans = min(ans, xx);
		}
	    if (ans <= b) l = md;
		else r = md-1;
	}
	return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 404 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 380 KB Output is correct
26 Correct 3 ms 380 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 508 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 18 ms 1528 KB Output is correct
4 Incorrect 18 ms 1528 KB Output isn't correct
5 Halted 0 ms 0 KB -