Submission #495672

# Submission time Handle Problem Language Result Execution time Memory
495672 2021-12-19T21:50:16 Z AndresTL Rice Hub (IOI11_ricehub) C++11
100 / 100
18 ms 1812 KB
#include "ricehub.h"
#include <algorithm>
typedef long long ll;
using namespace std;
int besthub(int R, int L, int X[], long long B){
  int l=0,r=0, m, nueva_m=0, MaxR=1;
  ll b_gastado = 0;
  while(r<R-1){
    if (b_gastado<=B){
      r++;
      m=(l+r)/2;
      b_gastado+=abs(X[r]-X[m]);
      if (b_gastado<=B) MaxR=max(MaxR,r-l+1);
    }else{
      l++;
      nueva_m=(l+r)/2;
      b_gastado-=abs(X[nueva_m]-X[l-1]);
      if (b_gastado<=B) MaxR=max(MaxR,r-l+1);
    }
  }
  return MaxR;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 288 KB Output is correct
13 Correct 0 ms 292 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 0 ms 296 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 0 ms 292 KB Output is correct
24 Correct 0 ms 296 KB Output is correct
25 Correct 0 ms 288 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 296 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 300 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 432 KB Output is correct
2 Correct 3 ms 496 KB Output is correct
3 Correct 15 ms 1684 KB Output is correct
4 Correct 16 ms 1696 KB Output is correct
5 Correct 6 ms 800 KB Output is correct
6 Correct 6 ms 720 KB Output is correct
7 Correct 13 ms 1428 KB Output is correct
8 Correct 14 ms 1360 KB Output is correct
9 Correct 6 ms 652 KB Output is correct
10 Correct 6 ms 680 KB Output is correct
11 Correct 18 ms 1812 KB Output is correct
12 Correct 15 ms 1668 KB Output is correct
13 Correct 7 ms 816 KB Output is correct
14 Correct 6 ms 848 KB Output is correct
15 Correct 11 ms 1292 KB Output is correct
16 Correct 10 ms 1352 KB Output is correct
17 Correct 13 ms 1488 KB Output is correct
18 Correct 14 ms 1720 KB Output is correct
19 Correct 13 ms 1568 KB Output is correct
20 Correct 13 ms 1536 KB Output is correct