Submission #460440

# Submission time Handle Problem Language Result Execution time Memory
460440 2021-08-09T06:49:42 Z fuad27 Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 332 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 = 0;
		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 Correct 0 ms 224 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 3 ms 204 KB Output is correct
22 Correct 2 ms 204 KB Output is correct
23 Correct 2 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 2 ms 204 KB Output is correct
27 Correct 2 ms 204 KB Output is correct
28 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 4 ms 300 KB Output is correct
4 Correct 5 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 5 ms 204 KB Output is correct
8 Correct 7 ms 204 KB Output is correct
9 Correct 3 ms 204 KB Output is correct
10 Correct 3 ms 204 KB Output is correct
11 Correct 5 ms 204 KB Output is correct
12 Correct 6 ms 204 KB Output is correct
13 Correct 4 ms 204 KB Output is correct
14 Correct 5 ms 304 KB Output is correct
15 Correct 3 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Correct 2 ms 204 KB Output is correct
18 Correct 4 ms 256 KB Output is correct
19 Correct 4 ms 204 KB Output is correct
20 Correct 4 ms 204 KB Output is correct
21 Correct 117 ms 204 KB Output is correct
22 Correct 116 ms 300 KB Output is correct
23 Correct 80 ms 300 KB Output is correct
24 Correct 84 ms 204 KB Output is correct
25 Correct 83 ms 300 KB Output is correct
26 Correct 94 ms 304 KB Output is correct
27 Correct 151 ms 204 KB Output is correct
28 Correct 113 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -