Submission #775498

# Submission time Handle Problem Language Result Execution time Memory
775498 2023-07-06T12:59:16 Z ttamx Rice Hub (IOI11_ricehub) C++14
58 / 100
12 ms 2516 KB
#include "ricehub.h"
#include<bits/stdc++.h>

typedef long long ll;

using namespace std;

int besthub(int R, int L, int X[], ll B){
	vector<ll> qs(R);
	for(int i=0;i<R;i++)qs[i]=X[i];
	for(int i=1;i<R;i++)qs[i]+=qs[i-1];
	auto sum=[&](int l,int r){
		return qs[r]-(l>0?qs[l-1]:0);
	};
	auto check=[&](int req){
		for(int l=0,r=req-1;r<R;l++,r++){
			int m=(l+r)/2;
			ll res=(1ll*X[m]*(m-l)-sum(l,m-1))+(sum(m+1,r)-1ll*X[m]*(r-m));
			if(res<=B)return true;
		}
		return false;
	};
	int l=1,r=R;
	while(l<r){
		int m=(l+r+1)/2;
		if(check(m))l=m;
		else r=m-1;
	}
	return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 316 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 324 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 3 ms 580 KB Output is correct
3 Correct 10 ms 2508 KB Output is correct
4 Correct 12 ms 2476 KB Output is correct
5 Correct 6 ms 1236 KB Output is correct
6 Correct 7 ms 1220 KB Output is correct
7 Correct 9 ms 2224 KB Output is correct
8 Correct 9 ms 2148 KB Output is correct
9 Correct 5 ms 1148 KB Output is correct
10 Correct 5 ms 1108 KB Output is correct
11 Correct 11 ms 2484 KB Output is correct
12 Correct 10 ms 2516 KB Output is correct
13 Correct 6 ms 1372 KB Output is correct
14 Correct 6 ms 1200 KB Output is correct
15 Correct 7 ms 1968 KB Output is correct
16 Correct 7 ms 1876 KB Output is correct
17 Correct 9 ms 2260 KB Output is correct
18 Correct 9 ms 2260 KB Output is correct
19 Correct 9 ms 2392 KB Output is correct
20 Correct 9 ms 2388 KB Output is correct