Submission #286339

# Submission time Handle Problem Language Result Execution time Memory
286339 2020-08-30T10:06:48 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 , l;
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 = 1 ; j < l + 1 ; j ++){


            for(int c = i ; c < md + i ; c ++){
                sum += abs(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 ;l = L ;
//    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 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -