답안 #655207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
655207 2022-11-03T14:40:58 Z PanTkd 쌀 창고 (IOI11_ricehub) C++14
17 / 100
1000 ms 340 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-1)/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 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1089 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -