제출 #1003258

#제출 시각아이디문제언어결과실행 시간메모리
1003258ayankarimovaRice Hub (IOI11_ricehub)C++14
42 / 100
1061 ms972 KiB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll sz=5005;
ll a[sz], b[sz], d[sz], s[sz];
int besthub(int r, int l, int x[], long long k)
{

    ll ans=0;
    for(int i=0; i<r; i++){
        vector<ll>v;
        for(int j=0; j<r; j++){
            v.push_back(abs(x[i]-x[j]));
            sort(v.begin(), v.end());
        }
        ll sum=0;
        for(int j=0; j<r; j++){
            if(sum+v[j]>k) break;
            sum+=v[j];
            ans=max(ans, (ll)j+1);
        }
    }
    return ans;
}
/*
{} []
5 20 6

1 2 10 12 14 3
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...