Submission #388068

# Submission time Handle Problem Language Result Execution time Memory
388068 2021-04-09T20:50:42 Z Pichon5 Rice Hub (IOI11_ricehub) C++17
68 / 100
1000 ms 2388 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,mid-i+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 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 2 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 2 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 6 ms 204 KB Output is correct
4 Correct 6 ms 316 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 2 ms 304 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 7 ms 204 KB Output is correct
14 Correct 7 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Correct 5 ms 204 KB Output is correct
18 Correct 5 ms 204 KB Output is correct
19 Correct 7 ms 316 KB Output is correct
20 Correct 7 ms 204 KB Output is correct
21 Correct 32 ms 332 KB Output is correct
22 Correct 32 ms 332 KB Output is correct
23 Correct 210 ms 360 KB Output is correct
24 Correct 244 ms 408 KB Output is correct
25 Correct 206 ms 348 KB Output is correct
26 Correct 207 ms 424 KB Output is correct
27 Correct 155 ms 384 KB Output is correct
28 Correct 154 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 320 ms 476 KB Output is correct
2 Correct 317 ms 604 KB Output is correct
3 Execution timed out 1082 ms 2388 KB Time limit exceeded
4 Halted 0 ms 0 KB -