답안 #286481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
286481 2020-08-30T13:08:39 Z Ruba_K 쌀 창고 (IOI11_ricehub) C++14
42 / 100
1000 ms 640 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std ;


vector<int>v;
long long mx , l;
bool ok(int md){
    long long sum = 0 , mn = 1e18 ;
    int sz = v.size();
    for(int i = 0 ; i <= sz - md ; i ++){
        for(int j = i ; j < i + md ; j ++){


            for(int c = i ; c < md + i ; c ++){
                sum += abs(v[j] - v[c]);
            }
            mn = min(mn , sum);
            sum = 0 ;

        }
        //B : continue ;

       if(mn <= mx)return true ;
    }
    return false ;

}/*
5 20 6
1 2 10 12 14
3
*/
int besthub(int R, int L, int X[], long long B)
{   mx = B ;l = L ;
//    vector<int>v;

    for(int i = 0 ; i < R ; i ++)
        v.push_back(X[i]);

    int l = 0 , r = R , md ;

    while(l < r){
        md = (l + r + 1) / 2 ;

        if(ok(md))l = md ;

        else r = md - 1 ;
    }




    return l ;

  return R;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 36 ms 256 KB Output is correct
22 Correct 38 ms 376 KB Output is correct
23 Correct 44 ms 376 KB Output is correct
24 Correct 58 ms 256 KB Output is correct
25 Correct 89 ms 376 KB Output is correct
26 Correct 66 ms 376 KB Output is correct
27 Correct 117 ms 372 KB Output is correct
28 Correct 117 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 36 ms 504 KB Output is correct
6 Correct 31 ms 376 KB Output is correct
7 Correct 214 ms 504 KB Output is correct
8 Correct 217 ms 384 KB Output is correct
9 Correct 38 ms 376 KB Output is correct
10 Correct 32 ms 376 KB Output is correct
11 Correct 147 ms 384 KB Output is correct
12 Correct 151 ms 384 KB Output is correct
13 Correct 10 ms 384 KB Output is correct
14 Correct 10 ms 384 KB Output is correct
15 Correct 92 ms 376 KB Output is correct
16 Correct 92 ms 376 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 10 ms 384 KB Output is correct
20 Correct 9 ms 384 KB Output is correct
21 Execution timed out 1090 ms 384 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -