Submission #388040

# Submission time Handle Problem Language Result Execution time Memory
388040 2021-04-09T19:36:23 Z Pichon5 Rice Hub (IOI11_ricehub) C++17
0 / 100
1000 ms 624 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)
{
    int res=0;
    for(int i=0;i<R;i++){
        vi v;
        for(int l=i;l<R;l++){
            v.pb(i);
            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:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             for(int j=0;j<v.size();j++){
      |                         ~^~~~~~~~~
# 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 2 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 624 KB Time limit exceeded
2 Halted 0 ms 0 KB -