Submission #719542

# Submission time Handle Problem Language Result Execution time Memory
719542 2023-04-06T09:30:06 Z mseebacher Rice Hub (IOI11_ricehub) C++17
0 / 100
526 ms 632 KB
#include <bits/stdc++.h> 

using namespace std;

int besthub(int R, int L, int x[], long long B)
{
	vector<long long> pref(R+1,0);
	for(int i = 0;i<R;i++){
		pref[i+1] = pref[i]+x[i];
	}
	int ans = 0;
	for(int i = 1;i<=R;i++){
		for(int j = i+1;j<=R;j++){
			int mid = (i+j) >> 1;
			long long cost = (long long)(mid-i+1)*x[mid]-pref[mid]-pref[i-1]; // Seg unten
			cost += (long long)pref[j]-pref[mid]-(j-mid)*x[mid]; // seg oben
			if(cost <= B) ans = max(ans,j-i+1);
		}
	}
  return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 526 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -