Submission #922142

# Submission time Handle Problem Language Result Execution time Memory
922142 2024-02-05T06:48:48 Z tamir1 Rice Hub (IOI11_ricehub) C++14
100 / 100
11 ms 1884 KB
#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ans,cur,i,sz,med,fi;
int besthub(int R, int L, int X[], long long B)
{
	fi=-1;
	sz=1;
	for(i=1;i<R;i++){
		sz++;
		if(sz%2==1){
			cur+=(X[i]-X[med]);
		}
		else{
			cur+=(X[med+1]-X[med]);
			med++;
			cur+=(X[i]-X[med]);
		}
		while(cur>B){
			sz--;
			fi++;
			if(sz%2==1){
				cur-=(X[med]-X[fi]);
			}
			else{
				cur+=(X[med+1]-X[med]);
				med++;
				cur-=(X[med]-X[fi]);
			}
		}
		ans=max(ans,sz);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 444 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 452 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 452 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 448 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 444 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 388 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 448 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 432 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 9 ms 1880 KB Output is correct
4 Correct 11 ms 1884 KB Output is correct
5 Correct 4 ms 860 KB Output is correct
6 Correct 5 ms 972 KB Output is correct
7 Correct 8 ms 1448 KB Output is correct
8 Correct 9 ms 1372 KB Output is correct
9 Correct 4 ms 716 KB Output is correct
10 Correct 4 ms 860 KB Output is correct
11 Correct 9 ms 1880 KB Output is correct
12 Correct 9 ms 1872 KB Output is correct
13 Correct 4 ms 856 KB Output is correct
14 Correct 4 ms 860 KB Output is correct
15 Correct 7 ms 1368 KB Output is correct
16 Correct 7 ms 1368 KB Output is correct
17 Correct 8 ms 1624 KB Output is correct
18 Correct 8 ms 1880 KB Output is correct
19 Correct 9 ms 1628 KB Output is correct
20 Correct 9 ms 1628 KB Output is correct