Submission #655196

# Submission time Handle Problem Language Result Execution time Memory
655196 2022-11-03T14:19:05 Z PanTkd Rice Hub (IOI11_ricehub) C++14
17 / 100
1000 ms 468 KB
#include "ricehub.h"
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
  for(ll i = R;i>=1;i--){
    for(ll j = 0;j<R-i;j++){
      ll cost = 0;
      ll med = i/2+j;
      for(ll k = j ;k<=j+i-1 && k<=R;k++){
        cost+= abs(X[med]-X[k]);
      }
      if(cost<=B)
        return i;
    }
  }
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -