Submission #388061

# Submission time Handle Problem Language Result Execution time Memory
388061 2021-04-09T20:13:02 Z Pichon5 Rice Hub (IOI11_ricehub) C++17
0 / 100
338 ms 472 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#define vi vector<int>
#define pb push_back
#define ll long long int
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
    vi v;
    int res=0;
    for(int i=0;i<R;i++){
        int b=i,e=R-1;
        while(b<=e){
            int mid=(b+e)/2;
            v.clear();
            for(int l=i;l<=mid;l++){
                v.pb(X[l]);
            }
            int MID=v.size()/2;
            ll aux=0;
            for(int l=0;l<v.size();l++){
                aux+=abs(v[l]-v[MID]);
            }
            if(aux<=B){
                res=max(res,e-b+1);
                b=mid+1;
            }else{
                e=mid-1;
            }
        }
    }
    return res;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:21:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for(int l=0;l<v.size();l++){
      |                         ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 338 ms 472 KB Output isn't correct
2 Halted 0 ms 0 KB -