답안 #411228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411228 2021-05-24T18:14:16 Z LouayFarah 쌀 창고 (IOI11_ricehub) C++14
17 / 100
409 ms 352 KB
#include "bits/stdc++.h"
#include "ricehub.h"
using namespace std;
 
long long S(int X[], int h, int l, int r)
{
    long long sum = 0;
    for(int i = l; i<=r; i++)
        sum = sum + abs(h-X[i]);
    return sum;
}
 
int besthub(int R, int L, int X[], long long B)
{
    int res = 0;
 
    int r = R;
    for(int it = 0; it<100; it++)
    {
        int k = r/2;
        bool flag = false;
        for(int i = 0; i<=R-k; i++)
        {
            int curr = S(X, X[(2*i+k-1)/2], i, i+k-1);
            if(curr<=B)
                flag = true;
        }
        if(flag)
        {
            res = max(res, k);
            r+=k/2;
        }
        else
        {
            r = k;
        }
    }
 
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Incorrect 12 ms 304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 409 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -