Submission #460475

# Submission time Handle Problem Language Result Execution time Memory
460475 2021-08-09T07:11:27 Z fuad27 Rice Hub (IOI11_ricehub) C++14
0 / 100
618 ms 352 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int r, int l, int x[], long long b) {
	int MAX = 0;
	for(int i = 1;i<r;i++) {
		int c = 0;
		long long cost = 0;
		int p1 = 0, p2 = MAX;
		while(p1 < r and p2 <= r) {
			if(cost <= b) {
				c = max(p2 - p1, c);
				p2++;
				if(p2 <= r)
					cost+=abs(x[p2-1] - x[i]);
			}
			else {
				cost-=abs(x[p1]-x[i]);
				p1++;
			}
		}
		MAX = max(c, MAX);
	}
	return MAX;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 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 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 618 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -