Submission #307774

# Submission time Handle Problem Language Result Execution time Memory
307774 2020-09-29T09:52:40 Z amunduzbaev Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 884 KB
#include "ricehub.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
#define ll long long

int n,l,b,a[10005];

int fun(int x){
    vector<int>v(n);
    for(int i=0;i<n;i++){
        v[i]=(abs(a[i]-x));
    }
    sort(v.begin(),v.end());
    ll s=0;
    for(int i=0;i<n;i++){
        if(s+v[i]>b)
            return i;
        s+=v[i];
    }
    return n;
}

int besthub(int N, int L, int x[], ll B)
{
    n=N, l=L, b=B;
    int ans=0;

    for(int i=0;i<n;i++){
        a[i]=x[i];
    }

    for(int i=0;i<n;i++){
        ans=max(fun(a[i]),ans);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 4 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 7 ms 384 KB Output is correct
24 Correct 7 ms 384 KB Output is correct
25 Correct 6 ms 384 KB Output is correct
26 Correct 6 ms 384 KB Output is correct
27 Correct 6 ms 384 KB Output is correct
28 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 19 ms 380 KB Output is correct
4 Correct 19 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 14 ms 384 KB Output is correct
8 Correct 13 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 15 ms 384 KB Output is correct
12 Correct 15 ms 384 KB Output is correct
13 Correct 25 ms 384 KB Output is correct
14 Correct 25 ms 384 KB Output is correct
15 Correct 6 ms 384 KB Output is correct
16 Correct 6 ms 384 KB Output is correct
17 Correct 15 ms 384 KB Output is correct
18 Correct 15 ms 384 KB Output is correct
19 Correct 24 ms 256 KB Output is correct
20 Correct 24 ms 384 KB Output is correct
21 Correct 390 ms 504 KB Output is correct
22 Correct 388 ms 504 KB Output is correct
23 Correct 855 ms 424 KB Output is correct
24 Correct 838 ms 504 KB Output is correct
25 Correct 783 ms 428 KB Output is correct
26 Correct 771 ms 504 KB Output is correct
27 Correct 700 ms 504 KB Output is correct
28 Correct 698 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 884 KB Time limit exceeded
2 Halted 0 ms 0 KB -