Submission #1107635

# Submission time Handle Problem Language Result Execution time Memory
1107635 2024-11-01T18:48:52 Z Lincito_31 Rice Hub (IOI11_ricehub) C++17
0 / 100
3 ms 592 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int besthub(int R, int L, int X[], long long B)
{
  vll psum(R+1);
  psum[0]=0;
  psum[1]=X[0];
  for(int i=2;i<=R;i++){
    psum[i]=psum[i-1]+X[i-1];
  }
  int iz=0,de=0;
  int can=1;
  while(iz<R){
    de=max(de,iz);
    int mid=(iz+de)/2;
    ll sum=X[mid]*(mid-iz)-(psum[mid]-psum[iz]);
    sum+=psum[de+1]-psum[mid+1]-X[mid]*(de-mid);
    while(sum<=B && de<R){
      sum=X[mid]*(mid-iz)-(psum[mid]-psum[iz]);
      sum+=psum[de+1]-psum[mid+1]-X[mid]*(de-mid);
      de++;
    }
    can=max(can,de-iz);
    iz++;
  }
  return can;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -