Submission #552397

# Submission time Handle Problem Language Result Execution time Memory
552397 2022-04-23T05:48:07 Z Wasrek Rice Hub (IOI11_ricehub) C++14
0 / 100
7 ms 508 KB
#include<bits/stdc++.h>
// #include "grader.cpp"
#include "ricehub.h"
using namespace std;
int qs[100010];
int besthub(int R, int L, int X[], long long B)
{
  for(int i=2;i<=R;i++){
    qs[i]=qs[i-1]+(X[i-1]-X[i-2]);
    // printf("%d ",qs[i]);
  }
  // printf("\n");
  int now=0,temp,ans=0;
  for(int i=1, j=1;i<=R && j<=R;i++){
    if(i!=1){//move i
      now-=qs[(i+j)/2]-qs[i];
    }
    if(j<i)j=i,now=0;
    temp=now;
    while(j<R){//move j
      temp+=(qs[j+1]-qs[(i+j+1)/2]);
      // printf("%d %d %d\n",i,j+1,temp);
      if(temp<=B) j++;
      else break;
    }
    // printf("%d %d\n",i,j);
    ans=max(ans,j-i+1);
  }                        
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 220 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 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 7 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -