Submission #922134

# Submission time Handle Problem Language Result Execution time Memory
922134 2024-02-05T06:37:47 Z tamir1 Rice Hub (IOI11_ricehub) C++14
0 / 100
5 ms 860 KB
#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll ans=1,cur,i,sz=1,med,fi=1;
int besthub(int R, int L, int X[], long long B)
{
	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 Runtime error 2 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -