Submission #526107

# Submission time Handle Problem Language Result Execution time Memory
526107 2022-02-13T18:29:50 Z Deepesson Rice Hub (IOI11_ricehub) C++17
26 / 100
517 ms 2816 KB
#include <bits/stdc++.h>
#include "ricehub.h"
typedef std::pair<long long,long long> pli;
pli custo(long long P,long long R,int X[],long long B){
    if(!P)return {0,0};
    std::vector<long long> vec;
    for(int i=0;i!=R;++i){
        long long dist = abs(X[i]-P);
        vec.push_back(dist);
    }
    std::sort(vec.begin(),vec.end());
    int res=0;
    for(auto&x:vec){
        if(x<=B){
            ++res;
            B-=x;
            continue;
        }
    }
    return {res,B};
}
int besthub(int R, int L, int X[], long long B)
{
   long long la=1,ra=L-1;
   while(ra-la>1){
        int m = (la+ra+1)/2;
        pli alpha = custo(m,R,X,B);
        pli beta = custo(m+1,R,X,B);
        if(alpha>=beta){
            ra=m;
        }else {la=m;}
   }
   return std::max(std::max(custo(la+1,R,X,B).first,custo(la,R,X,B).first),std::max(custo(1,R,X,B).first,custo(L,R,X,B).first));
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 304 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Incorrect 1 ms 204 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 316 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 2 ms 316 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 2 ms 204 KB Output is correct
19 Correct 2 ms 204 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 3 ms 440 KB Output is correct
22 Correct 3 ms 332 KB Output is correct
23 Correct 8 ms 436 KB Output is correct
24 Correct 8 ms 460 KB Output is correct
25 Correct 9 ms 440 KB Output is correct
26 Correct 8 ms 460 KB Output is correct
27 Correct 6 ms 344 KB Output is correct
28 Correct 5 ms 412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 804 KB Output is correct
2 Correct 20 ms 800 KB Output is correct
3 Correct 517 ms 2816 KB Output is correct
4 Correct 502 ms 2504 KB Output is correct
5 Correct 63 ms 1412 KB Output is correct
6 Correct 67 ms 1432 KB Output is correct
7 Correct 264 ms 2516 KB Output is correct
8 Correct 253 ms 2500 KB Output is correct
9 Correct 55 ms 1528 KB Output is correct
10 Correct 52 ms 1456 KB Output is correct
11 Correct 488 ms 2580 KB Output is correct
12 Correct 496 ms 2716 KB Output is correct
13 Incorrect 94 ms 1420 KB Output isn't correct
14 Halted 0 ms 0 KB -