Submission #696762

# Submission time Handle Problem Language Result Execution time Memory
696762 2023-02-07T08:00:24 Z vjudge1 Rice Hub (IOI11_ricehub) C++17
0 / 100
3 ms 596 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
long long pf[maxn], ki, ka, mid, idxtengah, cost, res, ans;

int besthub(int R, int L, int X[], long long B)
{
  for(int i=0; i<R; i++) {
    pf[i]=X[i]+(i?pf[i-1]:0);
    ki=0, ka=i;
    while(ki<=ka) {
      mid=(ki+ka)/2, idxtengah=(mid+i)/2;
      cost=idxtengah*X[idxtengah]-(idxtengah?pf[idxtengah-1]:0);
      cost+=pf[mid]-(idxtengah?pf[idxtengah-1]:0)-((mid-idxtengah)*X[idxtengah]);
      if(cost<=B) res=mid, ka=mid-1;
      else ki=mid+1;
    }
    ans=max(ans, i-res+1);
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -