Submission #500129

# Submission time Handle Problem Language Result Execution time Memory
500129 2021-12-30T10:55:09 Z beaconmc Rice Hub (IOI11_ricehub) C++14
0 / 100
27 ms 2128 KB
#include "ricehub.h"
#include <bits/stdc++.h>


typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)

using namespace std;



int besthub(int R, int L, int X[], ll B){
    sort(X, X+R);
    ll med;
    if (R%2==0) med = (X[R/2] + X[R/2-1])/2;
    else med = X[R/2];
    ll ans = 0;
    int costs[100000];
    FOR(i,0,R){
        costs[i] = abs(X[i] - med);
    }
    sort(costs, costs+R);
    FOR(i,0,R){
        if (B - costs[i] >=0) ans++, B-= costs[i];
        else break;
    }

    return ans;

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 588 KB Output is correct
2 Correct 1 ms 556 KB Output is correct
3 Correct 1 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Incorrect 1 ms 588 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 716 KB Output is correct
2 Correct 4 ms 844 KB Output is correct
3 Correct 21 ms 2128 KB Output is correct
4 Correct 27 ms 2112 KB Output is correct
5 Incorrect 8 ms 1208 KB Output isn't correct
6 Halted 0 ms 0 KB -