Submission #60998

# Submission time Handle Problem Language Result Execution time Memory
60998 2018-07-25T05:38:12 Z nvmdava Rice Hub (IOI11_ricehub) C++17
0 / 100
9 ms 656 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;


bool price(int X[], int l,int r, long long B){
	
	int i;
	long long p = 0;
	int m = (r + l) / 2;
	for(i = l; i <m ; i++){
		p +=(long long)X[m] - X[l];
	}
	for(i = m + 1; i <=r ; i++){
		p +=(long long)X[i] - X[m];
	}
	if(p <= B){
		return 1;
	} else {
		return 0;
	}
}

int besthub(int n, int L, int X[], long long B)
{
	int l = 0, r = 0, dif = -1;
	while(r != n){
		if(price(X ,l, r, B)){
			dif = max(dif, r - l + 1);
			r++;
		} else {
			l++;
		}
	}
	return dif;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Incorrect 3 ms 360 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 472 KB Output is correct
2 Correct 3 ms 556 KB Output is correct
3 Correct 3 ms 556 KB Output is correct
4 Incorrect 3 ms 568 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -