답안 #526106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526106 2022-02-13T18:19:44 Z Deepesson 쌀 창고 (IOI11_ricehub) C++17
0 / 100
499 ms 3672 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){
    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=0,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 custo(la+1,R,X,B).first;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 308 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 0 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 304 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 2 ms 308 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Incorrect 1 ms 304 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 800 KB Output is correct
2 Correct 17 ms 800 KB Output is correct
3 Correct 483 ms 2516 KB Output is correct
4 Correct 499 ms 2560 KB Output is correct
5 Correct 55 ms 1468 KB Output is correct
6 Correct 57 ms 1756 KB Output is correct
7 Correct 232 ms 3284 KB Output is correct
8 Correct 246 ms 3292 KB Output is correct
9 Correct 48 ms 1692 KB Output is correct
10 Correct 53 ms 1936 KB Output is correct
11 Correct 490 ms 3564 KB Output is correct
12 Correct 491 ms 3672 KB Output is correct
13 Incorrect 89 ms 1788 KB Output isn't correct
14 Halted 0 ms 0 KB -