Submission #224658

# Submission time Handle Problem Language Result Execution time Memory
224658 2020-04-18T14:29:28 Z jhtan Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 912 KB
#include "ricehub.h"
#include "bits/stdc++.h"

using namespace std;

int besthub(int R, int L, int X[], long long B)
{
  int mn = 2000000001;
  int sol = 0;
  
  for(int i=1; i<=L; i++) {
    int s = 0, c = 0;
    vector<int> V;
    for(int j=0; j<R; j++) V.push_back(abs(i-X[j]));
    sort(V.begin(), V.end());

    for(int j=0; j<R; j++) {
      if(s + V[j] <= B) {s += V[j]; c++;}
      else break;
    }

    if(s < mn) {
      mn = s;
      sol = c;
    }
  }
  
  return sol;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 912 KB Time limit exceeded
2 Halted 0 ms 0 KB -