Submission #823363

# Submission time Handle Problem Language Result Execution time Memory
823363 2023-08-12T11:32:32 Z 12345678 Rice Hub (IOI11_ricehub) C++17
68 / 100
1000 ms 2300 KB
#include "ricehub.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

int besthub(int R, int L, int X[], long long B)
{
  int ans=1;
  vector<ll> qs(R+1), v(R+1);
  for (int i=0; i<R; i++) v[i+1]=X[i], qs[i+1]=qs[i]+v[i+1];
  for (int i=1; i<=R; i++) 
  {
    for (int j=i+1; j<=R; j++)
    {
      int md=(i+j)/2;
      ll ls=v[md]*(md-i+1)-(qs[md]-qs[i-1]);
      ll rs=qs[j]-qs[md]-v[md]*(j-md);
      //cout<<i<<' '<<j<<' '<<ls<<' '<<rs<<'\n';
      if (ls+rs<=B) ans=max(ans, j-i+1);
    }
  }
  return ans;
}
# 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 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 Correct 0 ms 312 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 316 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 308 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 0 ms 312 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 304 KB Output is correct
28 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 29 ms 340 KB Output is correct
22 Correct 28 ms 340 KB Output is correct
23 Correct 32 ms 408 KB Output is correct
24 Correct 32 ms 340 KB Output is correct
25 Correct 32 ms 340 KB Output is correct
26 Correct 32 ms 340 KB Output is correct
27 Correct 31 ms 340 KB Output is correct
28 Correct 31 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 471 ms 696 KB Output is correct
2 Correct 429 ms 696 KB Output is correct
3 Execution timed out 1080 ms 2300 KB Time limit exceeded
4 Halted 0 ms 0 KB -