Submission #563310

# Submission time Handle Problem Language Result Execution time Memory
563310 2022-05-16T20:47:56 Z 1ne Rice Hub (IOI11_ricehub) C++14
0 / 100
172 ms 700 KB
//#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
  int ans = 1;
  vector<int64_t>pref(R + 1,0),dpref(R + 1,0);
  for (int i = 0 ;i<R - 1;++i){
	  pref[i + 1] = pref[i] + (X[i + 1] - X[i]);
	  dpref[i + 2] = pref[i + 1] + dpref[i + 1];
  }
  //for (int i = 0;i<R;++i)cout<<dpref[i]<<" ";
  //cout<<'\n';
  //1 3 18 - 
  auto dist = [&](int l,int r){
	 return pref[r] * (r - l) - dpref[r] + dpref[l]<=B;
  };
  for (int i = 0;i<R;++i){
	 for (int j = i + 1;j<R;++j){
		if (dist(i,j))ans = max(ans,j - i + 1);
		//cout<<i<<" "<<j<<" "<<dist(i,j)<<'\n';
	}
  }	
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 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 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 172 ms 700 KB Output isn't correct
2 Halted 0 ms 0 KB -