답안 #1056740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056740 2024-08-13T10:48:30 Z PikachudoraEHE 쌀 창고 (IOI11_ricehub) C++14
68 / 100
17 ms 3244 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;

long long idx[100005];int n;long long qs[100005];int b;

bool chk(int a){
    long long mi=LLONG_MAX;
    for(int l=1;l<=n-a+1;l++){
        int r =l+a-1;int m=(l+r)/2;
        mi=min(mi,(m-l+1)*idx[m]-qs[m]+qs[l-1]-(r-m)*(idx[m])+qs[r]-qs[m]);
    }
return mi<=b;
}

int besthub(int R, int L, int X[], long long B){
    int l=0;int r=R;n=R;b=B;
    for(int i=0;i<R;i++){idx[i+1]=X[i];qs[i+1]=qs[i]+idx[i+1];}
    while(l<r){
        int mid = (l+r+1)/2;
        if(chk(mid)){
            l=mid;
        }
        else{
            r =mid-1;
        }
    }
  return l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2496 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2492 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2392 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 0 ms 2496 KB Output is correct
17 Correct 0 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2392 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 0 ms 2396 KB Output is correct
22 Correct 0 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 1 ms 2496 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2488 KB Output is correct
27 Correct 1 ms 2408 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2496 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 0 ms 2392 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 0 ms 2652 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2500 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2652 KB Output is correct
2 Correct 2 ms 2628 KB Output is correct
3 Incorrect 17 ms 3244 KB Output isn't correct
4 Halted 0 ms 0 KB -