제출 #1354863

#제출 시각아이디문제언어결과실행 시간메모리
1354863Charizard2021쌀 창고 (IOI11_ricehub)C++20
68 / 100
1095 ms1324 KiB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B){
    int res = 0;
    for(int i = 0; i < R; i++){
        vector<long long> dist;
        for(int j = 0; j < R; j++){
            dist.push_back(abs(X[i] - X[j]));
        }
        sort(dist.begin(), dist.end());
        long long cur = 0;
        int cnt = 0;
        for(int j = 0; j < R; j++){
            if(cur + dist[j] <= B){
                cur += dist[j];
                cnt++;
            }
        }
        res = max(res, cnt);
    }
    return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...