답안 #16773

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16773 2015-09-25T13:37:00 Z atomzeno 쌀 창고 (IOI11_ricehub) C++
0 / 100
27 ms 5380 KB
#include "ricehub.h"
#include<algorithm>
#define MX 100004
using namespace std;
int x[MX],n;
long long int r=1,BB,s;
int OK(int X){
    int i,dd=X-(X/2),ee=(X/2);
    s=0;
    for(i=1;i<=ee;i++){
        s+=((long long int)x[i+dd]-x[i]);
    }
    if(s<=BB){return 1;}
    for(i=ee+1;i<=n-X+1;i++){
        s+=(x[i+dd]-x[i])-(x[i+dd-1]-x[i-1]);
        if(s<=BB){return 1;}
    }
    return 0;
}
int besthub(int R, int L, int X[], long long B){
    n=R;
    int s=0,e=n+1,m;
    BB=B;
    int i;
    for(i=1;i<=n;i++){x[i]=X[i-1];}
    sort(x+1,x+1+n);
    for(;;){
        if((s+1)==e)return s;
        m=(s+e)/2;
        if(OK(m)==1){s=m;}
        else{e=m;}
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5380 KB Output is correct
2 Correct 0 ms 5380 KB Output is correct
3 Incorrect 0 ms 5380 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5380 KB Output is correct
2 Correct 0 ms 5380 KB Output is correct
3 Correct 0 ms 5380 KB Output is correct
4 Correct 0 ms 5380 KB Output is correct
5 Correct 0 ms 5380 KB Output is correct
6 Correct 0 ms 5380 KB Output is correct
7 Correct 0 ms 5380 KB Output is correct
8 Correct 0 ms 5380 KB Output is correct
9 Incorrect 0 ms 5380 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5380 KB Output is correct
2 Correct 0 ms 5380 KB Output is correct
3 Correct 0 ms 5380 KB Output is correct
4 Correct 0 ms 5380 KB Output is correct
5 Incorrect 0 ms 5380 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5380 KB Output is correct
2 Correct 5 ms 5380 KB Output is correct
3 Correct 27 ms 5380 KB Output is correct
4 Correct 20 ms 5380 KB Output is correct
5 Incorrect 0 ms 5380 KB Output isn't correct
6 Halted 0 ms 0 KB -