Submission #1109875

# Submission time Handle Problem Language Result Execution time Memory
1109875 2024-11-08T01:56:37 Z santi3223 Rice Hub (IOI11_ricehub) C++14
100 / 100
15 ms 4512 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define ff(i, p, x) for (ll i = p; i < x; i++)
#define ed "\n"

int besthub(int r, int l, int x[], ll b){
	vl psum(r+1, 0);
	ff(i, 0, r){
		psum[i+1] = psum[i]+x[i];
	}
	ll ri = 0, c = 0;
	ff(le, 0, r){
		while(ri < r){
			ll mid = (le+ri+1)/2;
			ll q = 0;
			if((le+ri+1) % 2 != 0){
				q -= x[mid];
			}
			q -= psum[mid]-psum[le];
			q += psum[ri+1] - psum[mid];
			if(q > b){
				break;
			}
			ri++;
		}
		c = max(c, ri-le);
		if(ri == r){
			break;
		}
	}
	return c;
}

//cambio de valores
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 508 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 504 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 380 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 504 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 592 KB Output is correct
2 Correct 3 ms 592 KB Output is correct
3 Correct 12 ms 4432 KB Output is correct
4 Correct 11 ms 4512 KB Output is correct
5 Correct 5 ms 3408 KB Output is correct
6 Correct 6 ms 3252 KB Output is correct
7 Correct 9 ms 4176 KB Output is correct
8 Correct 9 ms 4152 KB Output is correct
9 Correct 5 ms 3152 KB Output is correct
10 Correct 4 ms 3152 KB Output is correct
11 Correct 10 ms 4448 KB Output is correct
12 Correct 10 ms 4456 KB Output is correct
13 Correct 5 ms 3300 KB Output is correct
14 Correct 6 ms 3408 KB Output is correct
15 Correct 15 ms 4044 KB Output is correct
16 Correct 7 ms 3920 KB Output is correct
17 Correct 9 ms 4344 KB Output is correct
18 Correct 13 ms 4136 KB Output is correct
19 Correct 10 ms 4176 KB Output is correct
20 Correct 9 ms 4176 KB Output is correct