Submission #388042

# Submission time Handle Problem Language Result Execution time Memory
388042 2021-04-09T19:41:26 Z Pichon5 Rice Hub (IOI11_ricehub) C++17
42 / 100
1000 ms 484 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++){
        v.clear();
        for(int l=i;l<R;l++){
            v.pb(X[l]);
            int ans=0;
            ll Baux=B;
            int mid=v.size()/2;
            for(int j=0;j<v.size();j++){
                if(Baux-abs(v[j]-v[mid])>=0){
                    ans++;
                    Baux-=abs(v[j]-v[mid]);
                }else{
                    break;
                }
            }
            res=max(res,ans);
        }
    }
    return res;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:18:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             for(int j=0;j<v.size();j++){
      |                         ~^~~~~~~~~
# 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 1 ms 304 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 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 308 KB Output is correct
11 Correct 1 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 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Correct 5 ms 204 KB Output is correct
22 Correct 5 ms 204 KB Output is correct
23 Correct 26 ms 312 KB Output is correct
24 Correct 26 ms 204 KB Output is correct
25 Correct 25 ms 308 KB Output is correct
26 Correct 27 ms 292 KB Output is correct
27 Correct 14 ms 204 KB Output is correct
28 Correct 14 ms 312 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 147 ms 444 KB Output is correct
4 Correct 150 ms 304 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 19 ms 332 KB Output is correct
8 Correct 18 ms 204 KB Output is correct
9 Correct 7 ms 204 KB Output is correct
10 Correct 7 ms 336 KB Output is correct
11 Correct 18 ms 204 KB Output is correct
12 Correct 17 ms 324 KB Output is correct
13 Correct 208 ms 316 KB Output is correct
14 Correct 197 ms 312 KB Output is correct
15 Correct 16 ms 312 KB Output is correct
16 Correct 16 ms 312 KB Output is correct
17 Correct 100 ms 324 KB Output is correct
18 Correct 100 ms 204 KB Output is correct
19 Correct 196 ms 300 KB Output is correct
20 Correct 192 ms 304 KB Output is correct
21 Correct 663 ms 380 KB Output is correct
22 Correct 667 ms 384 KB Output is correct
23 Execution timed out 1092 ms 332 KB Time limit exceeded
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 484 KB Time limit exceeded
2 Halted 0 ms 0 KB -