Submission #234267

# Submission time Handle Problem Language Result Execution time Memory
234267 2020-05-23T15:37:33 Z pere_gil Rice Hub (IOI11_ricehub) C++14
42 / 100
1000 ms 1452 KB
#include "ricehub.h"
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

ll absolute(int a, int b){
    int res=a-b;
    if(res<0) res*=-1;
    return res;
}

int besthub(int R, int L, int X[], ll B)
{
    ll big=0;
    for(int i=1;i<=L;i++){
        ll transported=0;
        ll a=0;
        std::vector<ll> dist;
        for(int j=0;j<R;j++) dist.push_back(absolute(i,X[j]));
        sort(dist.begin(), dist.end());
        for(int j=0;j<R;j++){
            if(transported+dist[j]<=B){ transported+=dist[j]; a++; }
            else break;
        }
        big=max(big, a);
    }

    return big;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Correct 7 ms 256 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 7 ms 256 KB Output is correct
16 Correct 7 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 7 ms 256 KB Output is correct
20 Correct 7 ms 256 KB Output is correct
21 Correct 12 ms 384 KB Output is correct
22 Correct 11 ms 384 KB Output is correct
23 Correct 116 ms 384 KB Output is correct
24 Correct 116 ms 384 KB Output is correct
25 Correct 106 ms 376 KB Output is correct
26 Correct 109 ms 384 KB Output is correct
27 Correct 94 ms 384 KB Output is correct
28 Correct 95 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 384 KB Output is correct
2 Correct 34 ms 372 KB Output is correct
3 Execution timed out 1042 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 1452 KB Time limit exceeded
2 Halted 0 ms 0 KB -