Submission #580857

# Submission time Handle Problem Language Result Execution time Memory
580857 2022-06-22T02:36:43 Z benson1029 Rice Hub (IOI11_ricehub) C++14
100 / 100
18 ms 1620 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;

long long sum = 0;

int besthub(int R, int L, int X[], long long B)
{
	sort(X, X+R);
	int ptr = 0;
	int ans = 0;
	for(int i=0; i<R; i++) {
		if(ptr < i) {
			ptr = i;
			sum = 0;
		}
		while(ptr<R-1 && sum - X[(i+ptr+1)/2] + X[ptr+1] <= B) {
			sum = sum - X[(i+ptr+1)/2] + X[ptr+1];
			ptr++;
		}
		ans = max(ans, ptr-i+1);
		sum = sum + X[i] - X[(i+ptr+1)/2];
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 308 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 360 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 2 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 13 ms 688 KB Output is correct
4 Correct 14 ms 596 KB Output is correct
5 Correct 10 ms 468 KB Output is correct
6 Correct 6 ms 468 KB Output is correct
7 Correct 12 ms 596 KB Output is correct
8 Correct 12 ms 596 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 6 ms 440 KB Output is correct
11 Correct 14 ms 644 KB Output is correct
12 Correct 14 ms 596 KB Output is correct
13 Correct 6 ms 400 KB Output is correct
14 Correct 7 ms 824 KB Output is correct
15 Correct 12 ms 1364 KB Output is correct
16 Correct 15 ms 1364 KB Output is correct
17 Correct 14 ms 1556 KB Output is correct
18 Correct 14 ms 1572 KB Output is correct
19 Correct 18 ms 1604 KB Output is correct
20 Correct 15 ms 1620 KB Output is correct