Submission #284012

# Submission time Handle Problem Language Result Execution time Memory
284012 2020-08-26T13:00:26 Z Haunted_Cpp Rice Hub (IOI11_ricehub) C++17
0 / 100
1000 ms 976 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
 
int besthub(int R, int L, int X[], long long B) {
  int mx = 0;
  for (int i = 0; i < R; i++) {
    vector<int> dist;
    for (int j = i; j < R; j++) {
      dist.emplace_back( abs (X[i] - X[j] ) );
    }
    sort (dist.begin(), dist.end());
    long long cur = B;
    int got = 0;
    for (int i = 0; i < R; i++) {
      if (cur - dist[i] >= 0) {
        cur -= dist[i];
        ++got;
      } else break;
    }
    mx = max (mx, got);
  }
  return mx;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 976 KB Time limit exceeded
2 Halted 0 ms 0 KB -