Submission #1109870

# Submission time Handle Problem Language Result Execution time Memory
1109870 2024-11-08T01:47:36 Z santi3223 Rice Hub (IOI11_ricehub) C++17
0 / 100
3 ms 592 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-le)/2;
			if(le % 2 == ri % 2){
				mid++;
			}
			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++;
		}
		if(c < ri-le){
			c = ri-le;
		}
		if(ri == r){
			break;
		}
	}
	return c;
}

//variables???
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 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 Incorrect 1 ms 336 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -