제출 #1327191

#제출 시각아이디문제언어결과실행 시간메모리
1327191vahagng쌀 창고 (IOI11_ricehub)C++20
0 / 100
0 ms332 KiB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

int besthub(int R, int L, int X[], long long B){
  if (R == 1) {
    return 1;
  }
  int ans = 0;
  for (int i = 0; i < R - 1; i++) {
    int pos = (X[i] + X[i + 1]) / 2;
    priority_queue<long long>pq;
    for (int j = 0; j < R; j++) {
      pq.push({ -abs(X[j] - pos) });
    }
    long long cur = B;
    int c = 0;
    while (!pq.empty()){
      auto C = pq.top();
      pq.pop();
      if(cur + C < 0) break;
      cur += C;
      c++;
    }
    ans = max(ans, c);
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...