답안 #503130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
503130 2022-01-07T10:43:13 Z jk410 쌀 창고 (IOI11_ricehub) C++17
100 / 100
18 ms 3120 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int R,L;
ll X[100001],Sum_X[100001];
ll B;
int Ans;
ll f(int l,int r){
    int m=(l+r)>>1;
    return X[m]*(m-l)-(Sum_X[m-1]-Sum_X[l-1])+(Sum_X[r]-Sum_X[m])-X[m]*(r-m);
}
int besthub(int r,int l,int x[],ll b){
    R=r;
    L=l;
    for (int i=1; i<=R; i++){
        X[i]=x[i-1];
        Sum_X[i]=Sum_X[i-1]+X[i];
    }
    B=b;
    for (int i=1,j=1; i<=R; i++){
        while (j<R){
            if (f(i,j+1)>B)
                break;
            j++;
        }
        Ans=max(Ans,j-i+1);
    }
    return Ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 312 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 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 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 588 KB Output is correct
2 Correct 4 ms 588 KB Output is correct
3 Correct 15 ms 2128 KB Output is correct
4 Correct 18 ms 2140 KB Output is correct
5 Correct 5 ms 1220 KB Output is correct
6 Correct 5 ms 1228 KB Output is correct
7 Correct 10 ms 2252 KB Output is correct
8 Correct 10 ms 2252 KB Output is correct
9 Correct 4 ms 1228 KB Output is correct
10 Correct 4 ms 1228 KB Output is correct
11 Correct 11 ms 2252 KB Output is correct
12 Correct 11 ms 2216 KB Output is correct
13 Correct 6 ms 1228 KB Output is correct
14 Correct 7 ms 1228 KB Output is correct
15 Correct 9 ms 1740 KB Output is correct
16 Correct 8 ms 1668 KB Output is correct
17 Correct 10 ms 1996 KB Output is correct
18 Correct 11 ms 2008 KB Output is correct
19 Correct 11 ms 3116 KB Output is correct
20 Correct 11 ms 3120 KB Output is correct