Submission #307670

# Submission time Handle Problem Language Result Execution time Memory
307670 2020-09-29T04:16:46 Z juggernaut Rice Hub (IOI11_ricehub) C++14
42 / 100
1000 ms 640 KB
#include"ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int n,a[100005];
long long b;
bool app(int l,int r){
    long long mn=1e18;
    for(int i=l;i<=r;i++){
        long long cnt=0;
        for(int j=l;j<=r;j++)
            cnt+=abs(a[j]-a[i]);
        mn=min(mn,cnt);
    }
    return mn<=b;
}
bool check(int x){
    bool flag=0;
    for(int i=0;i+x-1<n;i++)flag|=app(i,x+i-1);
    return flag;
}
int besthub(int N,int L,int A[],long long B){
    n=N;b=B;
    for(int i=0;i<n;i++)a[i]=A[i];
    int l=1,r=n,m;
    while(l<r){
        m=(l+r+1)>>1;
        if(check(m))l=m;
        else r=m-1;
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 46 ms 384 KB Output is correct
22 Correct 48 ms 380 KB Output is correct
23 Correct 146 ms 376 KB Output is correct
24 Correct 151 ms 384 KB Output is correct
25 Correct 149 ms 504 KB Output is correct
26 Correct 158 ms 376 KB Output is correct
27 Correct 148 ms 384 KB Output is correct
28 Correct 145 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 418 ms 388 KB Output is correct
4 Correct 409 ms 388 KB Output is correct
5 Correct 37 ms 384 KB Output is correct
6 Correct 36 ms 384 KB Output is correct
7 Correct 276 ms 504 KB Output is correct
8 Correct 276 ms 384 KB Output is correct
9 Correct 53 ms 380 KB Output is correct
10 Correct 52 ms 376 KB Output is correct
11 Correct 197 ms 504 KB Output is correct
12 Correct 186 ms 504 KB Output is correct
13 Correct 547 ms 504 KB Output is correct
14 Correct 553 ms 504 KB Output is correct
15 Correct 131 ms 376 KB Output is correct
16 Correct 128 ms 384 KB Output is correct
17 Correct 284 ms 384 KB Output is correct
18 Correct 284 ms 384 KB Output is correct
19 Correct 546 ms 384 KB Output is correct
20 Correct 570 ms 504 KB Output is correct
21 Execution timed out 1092 ms 384 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -