Submission #16774

# Submission time Handle Problem Language Result Execution time Memory
16774 2015-09-25T13:38:01 Z atomzeno Rice Hub (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=2;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;}
    }
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 Correct 0 ms 5380 KB Output is correct
10 Correct 0 ms 5380 KB Output is correct
11 Correct 0 ms 5380 KB Output is correct
12 Correct 0 ms 5380 KB Output is correct
13 Correct 0 ms 5380 KB Output is correct
14 Correct 0 ms 5380 KB Output is correct
15 Correct 0 ms 5380 KB Output is correct
16 Incorrect 0 ms 5380 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 Correct 0 ms 5380 KB Output is correct
10 Correct 0 ms 5380 KB Output is correct
11 Correct 0 ms 5380 KB Output is correct
12 Correct 0 ms 5380 KB Output is correct
13 Correct 0 ms 5380 KB Output is correct
14 Correct 0 ms 5380 KB Output is correct
15 Incorrect 0 ms 5380 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5380 KB Output is correct
2 Correct 0 ms 5380 KB Output is correct
3 Correct 26 ms 5380 KB Output is correct
4 Correct 19 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 13 ms 5380 KB Output is correct
8 Correct 16 ms 5380 KB Output is correct
9 Correct 11 ms 5380 KB Output is correct
10 Correct 0 ms 5380 KB Output is correct
11 Correct 27 ms 5380 KB Output is correct
12 Correct 20 ms 5380 KB Output is correct
13 Incorrect 0 ms 5380 KB Output isn't correct
14 Halted 0 ms 0 KB -