Submission #285961

# Submission time Handle Problem Language Result Execution time Memory
285961 2020-08-29T19:33:41 Z Ruba_K Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 768 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std ;


vector<int>v;
long long mx ;
bool ok(int md){
    long long sum = 0 , mn = 1e18 ;
    int sz = v.size();
    for(int i = 0 ; i <= sz - md ; i ++){
        for(int j = i ; j < i + md ; j ++){


            for(int c = i ; c < md + i ; c ++){
                sum += abs(v[j] - v[c]);
            }
            mn = min(mn , sum);
            sum = 0 ;

        }
        //B : continue ;

       if(mn <= mx)return true ;
    }
    return false ;

}
int besthub(int R, int L, int X[], long long B)
{   mx = B ;
//    vector<int>v;
   mx = B ;
    for(int i = 1 ; i < R ; i ++)
        v.push_back(X[i] - X[i - 1]);

    int l = 0 , r = R , md ;

    while(l < r){
        md = (l + r + 1) / 2 ;

        if(ok(md))l = md ;

        else r = md - 1 ;
    }




    return l ;

  return R;
}


# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -