Submission #977541

# Submission time Handle Problem Language Result Execution time Memory
977541 2024-05-08T06:34:56 Z Amaarsaa Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "ricehub.h"
using namespace std;
using ll = long long;
int besthub(int R, int L, int X[], long long B)	{
	ll s;
	int ans = 0, mn, l, r;
	for (int i = 0; i + 1 < R; i ++) {
		l = i;
		r = i + 1;
		s = 0;
		while (l >= 0 && r < R && s + (X[r]- X[l]) <= B) {
			s += (X[r] - X[l]);
			l --;
			r ++;
		}
		mn = INT_MAX;
		if ( l >= 0) {
			mn = min(mn, X[i] - X[l]);
		}
		if ( r < R) {
			mn = min(mn, X[r] - X[i + 1]);
		}
		if (mn + s <= B) {
			ans = max(ans, r - l);
		}
		else ans = max(ans, r - l - 1);
	}
	return ans;
}
/*
int R, L, X[100005], B;
void inp() {
	cin >> R >> L >> B;
	for (int i = 0; i < R; i ++) cin >> X[i];
}

int main() {
	inp();
	cout << besthub(R, L, X, B) << endl;
}

Compilation message

ricehub.cpp:31:1: error: unterminated comment
   31 | /*
      | ^