Submission #418245

# Submission time Handle Problem Language Result Execution time Memory
418245 2021-06-05T08:42:02 Z Azimjon Rice Hub (IOI11_ricehub) C++17
0 / 100
4 ms 332 KB
#include "ricehub.h"
#include <bits/stdc++.h>

using namespace std;

int besthub(int R, int L, int X[], long long B) {
	auto cost = [&](int x, int y) { return abs(X[x] - X[y]); };

	int ans = -1;

	for (int i = 0; i < R; i++) {
		int cans = 0;
		long long cb = B;
		for (int j = i; j < R; j++) {
			if (cb - cost(i, j) >= 0) {
				cb -= cost(i, j);
			} else {
				break;
			}
			cans++;
		}

		ans = max(cans, ans);
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -