Submission #16773

# Submission time Handle Problem Language Result Execution time Memory
16773 2015-09-25T13:37:00 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=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;}
    }
}
# 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 Incorrect 0 ms 5380 KB Output isn't correct
4 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 Incorrect 0 ms 5380 KB Output isn't correct
10 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 Incorrect 0 ms 5380 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -