Submission #70625

# Submission time Handle Problem Language Result Execution time Memory
70625 2018-08-23T07:45:49 Z doowey Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 2496 KB
#include "ricehub.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll ab(ll x){
  return max(x, -x);
}

int besthub(int n, int L, int X[], ll B){  
  int l = 1, r = n + 1;
  int k;
  bool ok;
  int med;
  ll sum = 0;
  while(l + 1 < r){
    k = (l + r)/2;
    ok = false;
    for(int i = 0;i <= n-k;i ++ ){
      med = (i + k - 1) / 2;
      sum = 0;
      for(int j = 0;j < k;j ++ ){
        sum += ab(X[i + j] - X[med]);
      }
      if(sum <= B)
        ok = true;
    }
    if(ok)
      l = k;
    else
      r = k;
  }
  return l;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 472 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 480 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 3 ms 508 KB Output is correct
5 Correct 2 ms 540 KB Output is correct
6 Correct 3 ms 672 KB Output is correct
7 Correct 3 ms 672 KB Output is correct
8 Correct 4 ms 672 KB Output is correct
9 Correct 2 ms 672 KB Output is correct
10 Correct 2 ms 692 KB Output is correct
11 Correct 3 ms 692 KB Output is correct
12 Correct 2 ms 692 KB Output is correct
13 Correct 3 ms 692 KB Output is correct
14 Correct 2 ms 692 KB Output is correct
15 Correct 3 ms 692 KB Output is correct
16 Correct 4 ms 736 KB Output is correct
17 Correct 3 ms 864 KB Output is correct
18 Correct 3 ms 864 KB Output is correct
19 Incorrect 3 ms 864 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 864 KB Output is correct
2 Correct 2 ms 864 KB Output is correct
3 Correct 4 ms 864 KB Output is correct
4 Correct 3 ms 864 KB Output is correct
5 Correct 3 ms 864 KB Output is correct
6 Correct 2 ms 864 KB Output is correct
7 Correct 4 ms 864 KB Output is correct
8 Correct 4 ms 972 KB Output is correct
9 Correct 3 ms 972 KB Output is correct
10 Correct 3 ms 972 KB Output is correct
11 Correct 3 ms 972 KB Output is correct
12 Correct 4 ms 972 KB Output is correct
13 Correct 4 ms 972 KB Output is correct
14 Correct 3 ms 1044 KB Output is correct
15 Incorrect 3 ms 1044 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 378 ms 1064 KB Output is correct
2 Correct 358 ms 1152 KB Output is correct
3 Execution timed out 1078 ms 2496 KB Time limit exceeded
4 Halted 0 ms 0 KB -