Submission #116283

# Submission time Handle Problem Language Result Execution time Memory
116283 2019-06-12T02:46:19 Z dragonslayerit Rice Hub (IOI11_ricehub) C++14
100 / 100
18 ms 2936 KB
#include "ricehub.h"
#include <vector>

int besthub(int R, int L, int X[], long long B)
{
  std::vector<long long> prefix({0});
  for(int i=0;i<R;i++){
    prefix.push_back(prefix.back()+X[i]);
  }
  int best=0;
  int j=1;
  for(int i=1;i<=R;i++){
    while(true){
      int kl=(i+j)/2;
      int kr=(i+j+1)/2;
      long long cost=(prefix[i]-prefix[kr-1])-(prefix[kl]-prefix[j-1]);
      if(cost<=B) break;
      j++;
    }
    best=std::max(best,i-j+1);
  }
  return best;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 412 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 300 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 428 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 356 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 512 KB Output is correct
22 Correct 3 ms 512 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 3 ms 512 KB Output is correct
27 Correct 3 ms 512 KB Output is correct
28 Correct 2 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 916 KB Output is correct
2 Correct 4 ms 896 KB Output is correct
3 Correct 16 ms 2908 KB Output is correct
4 Correct 16 ms 2936 KB Output is correct
5 Correct 8 ms 1532 KB Output is correct
6 Correct 8 ms 1532 KB Output is correct
7 Correct 14 ms 2552 KB Output is correct
8 Correct 15 ms 2552 KB Output is correct
9 Correct 8 ms 1404 KB Output is correct
10 Correct 8 ms 1404 KB Output is correct
11 Correct 18 ms 2936 KB Output is correct
12 Correct 18 ms 2928 KB Output is correct
13 Correct 9 ms 1532 KB Output is correct
14 Correct 10 ms 1532 KB Output is correct
15 Correct 14 ms 2552 KB Output is correct
16 Correct 14 ms 2552 KB Output is correct
17 Correct 16 ms 2808 KB Output is correct
18 Correct 17 ms 2800 KB Output is correct
19 Correct 17 ms 2808 KB Output is correct
20 Correct 17 ms 2860 KB Output is correct