Submission #70622

# Submission time Handle Problem Language Result Execution time Memory
70622 2018-08-23T07:44:04 Z doowey Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 1416 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;
  int k;
  bool ok;
  int med;
  ll sum = 0;
  while(l < r){
    k = (l + r)/2;
    cout << k << "  ";
    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 - 1;
  }
  return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 1416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 1416 KB Time limit exceeded
2 Halted 0 ms 0 KB -