답안 #16775

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16775 2015-09-25T13:48:39 Z atomzeno 쌀 창고 (IOI11_ricehub) C++
100 / 100
26 ms 6552 KB
#include "ricehub.h"
#include<algorithm>
#define MX 100004
using namespace std;
long long int x[MX],n,GER[MX];
long long int r=1,BB;
int OK(long long int X){
    long long int i,dd=(X+1)/2,cnt=0,ee=(X/2),s=0;
    for(i=1;i<=(n-dd);i++){
        GER[i]=x[i+dd]-x[i];
    }
    for(i=1;i<=ee;i++){s+=GER[i];}
    if(s<=BB)return 1;
    for(i=ee+1;i<=(n-dd);i++){
        s+=GER[i];
        s-=GER[i-ee];
        if(s<=BB)return 1;
    }
    if(s<=BB)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 6552 KB Output is correct
2 Correct 0 ms 6552 KB Output is correct
3 Correct 0 ms 6552 KB Output is correct
4 Correct 0 ms 6552 KB Output is correct
5 Correct 0 ms 6552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6552 KB Output is correct
2 Correct 0 ms 6552 KB Output is correct
3 Correct 0 ms 6552 KB Output is correct
4 Correct 0 ms 6552 KB Output is correct
5 Correct 0 ms 6552 KB Output is correct
6 Correct 0 ms 6552 KB Output is correct
7 Correct 0 ms 6552 KB Output is correct
8 Correct 0 ms 6552 KB Output is correct
9 Correct 0 ms 6552 KB Output is correct
10 Correct 0 ms 6552 KB Output is correct
11 Correct 0 ms 6552 KB Output is correct
12 Correct 0 ms 6552 KB Output is correct
13 Correct 0 ms 6552 KB Output is correct
14 Correct 0 ms 6552 KB Output is correct
15 Correct 0 ms 6552 KB Output is correct
16 Correct 0 ms 6552 KB Output is correct
17 Correct 0 ms 6552 KB Output is correct
18 Correct 0 ms 6552 KB Output is correct
19 Correct 0 ms 6552 KB Output is correct
20 Correct 0 ms 6552 KB Output is correct
21 Correct 0 ms 6552 KB Output is correct
22 Correct 0 ms 6552 KB Output is correct
23 Correct 0 ms 6552 KB Output is correct
24 Correct 0 ms 6552 KB Output is correct
25 Correct 0 ms 6552 KB Output is correct
26 Correct 0 ms 6552 KB Output is correct
27 Correct 0 ms 6552 KB Output is correct
28 Correct 0 ms 6552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 6552 KB Output is correct
2 Correct 0 ms 6552 KB Output is correct
3 Correct 0 ms 6552 KB Output is correct
4 Correct 0 ms 6552 KB Output is correct
5 Correct 0 ms 6552 KB Output is correct
6 Correct 0 ms 6552 KB Output is correct
7 Correct 0 ms 6552 KB Output is correct
8 Correct 1 ms 6552 KB Output is correct
9 Correct 0 ms 6552 KB Output is correct
10 Correct 0 ms 6552 KB Output is correct
11 Correct 0 ms 6552 KB Output is correct
12 Correct 0 ms 6552 KB Output is correct
13 Correct 1 ms 6552 KB Output is correct
14 Correct 0 ms 6552 KB Output is correct
15 Correct 0 ms 6552 KB Output is correct
16 Correct 1 ms 6552 KB Output is correct
17 Correct 0 ms 6552 KB Output is correct
18 Correct 0 ms 6552 KB Output is correct
19 Correct 0 ms 6552 KB Output is correct
20 Correct 0 ms 6552 KB Output is correct
21 Correct 0 ms 6552 KB Output is correct
22 Correct 0 ms 6552 KB Output is correct
23 Correct 0 ms 6552 KB Output is correct
24 Correct 0 ms 6552 KB Output is correct
25 Correct 0 ms 6552 KB Output is correct
26 Correct 0 ms 6552 KB Output is correct
27 Correct 0 ms 6552 KB Output is correct
28 Correct 0 ms 6552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6552 KB Output is correct
2 Correct 5 ms 6552 KB Output is correct
3 Correct 18 ms 6552 KB Output is correct
4 Correct 14 ms 6552 KB Output is correct
5 Correct 3 ms 6552 KB Output is correct
6 Correct 12 ms 6552 KB Output is correct
7 Correct 24 ms 6552 KB Output is correct
8 Correct 15 ms 6552 KB Output is correct
9 Correct 7 ms 6552 KB Output is correct
10 Correct 12 ms 6552 KB Output is correct
11 Correct 23 ms 6552 KB Output is correct
12 Correct 22 ms 6552 KB Output is correct
13 Correct 12 ms 6552 KB Output is correct
14 Correct 13 ms 6552 KB Output is correct
15 Correct 14 ms 6552 KB Output is correct
16 Correct 10 ms 6552 KB Output is correct
17 Correct 19 ms 6552 KB Output is correct
18 Correct 19 ms 6552 KB Output is correct
19 Correct 21 ms 6552 KB Output is correct
20 Correct 26 ms 6552 KB Output is correct