Submission #488664

# Submission time Handle Problem Language Result Execution time Memory
488664 2021-11-19T22:22:10 Z fun_day Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 1704 KB
#include <bits/stdc++.h>
 
using namespace std;

int besthub(int R, int L, int X[] , long long B){
  int best = 0;
  for(int i = 0 ; i < R ; i++){
    int ans = 0;
    long long s = 0;
    int l = i - 1 , r = i + 1;
    while(l >= 0 || r < R){
      if((l < 0) || (r < R && X[r] - X[i] <= X[i] - X[l])){
        s += X[r] - X[i];
        r++;
      }
      else if((r >= R) || (l >= 0 && X[i] - X[l] <= X[r] - X[i])){
        s += X[i] - X[l];
        l--;
      }
      if(s > B) break;
      ans++;
    }
    best = max(best , ans);
    if(best == R - 1) break;
  }
  return best + 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 324 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 2 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 4 ms 208 KB Output is correct
21 Correct 3 ms 204 KB Output is correct
22 Correct 4 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 47 ms 300 KB Output is correct
25 Correct 26 ms 204 KB Output is correct
26 Correct 84 ms 204 KB Output is correct
27 Correct 23 ms 204 KB Output is correct
28 Correct 24 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 460 KB Output is correct
2 Correct 5 ms 464 KB Output is correct
3 Correct 12 ms 1672 KB Output is correct
4 Execution timed out 1091 ms 1704 KB Time limit exceeded
5 Halted 0 ms 0 KB -