제출 #655209

#제출 시각아이디문제언어결과실행 시간메모리
655209PanTkdRice Hub (IOI11_ricehub)C++14
17 / 100
1074 ms340 KiB
#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;k++){
        cost+= abs(X[med]-X[k]);
      }
      if(cost<=B)
        return i;
    }
  }
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...