답안 #986799

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
986799 2024-05-21T08:46:49 Z huutuan 쌀 창고 (IOI11_ricehub) C++14
100 / 100
11 ms 3420 KB
#include "ricehub.h"

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int N=1e5+10;
int n, a[N], pf[N];

int calc(int l, int r){
   int mid=(l+r)>>1;
   return a[mid]*(mid-l+1)-(pf[mid]-pf[l-1])+(pf[r]-pf[mid])-a[mid]*(r-mid);
}

int32_t besthub(int32_t R, int32_t L, int32_t X[], int B)
{
   n=R;
   for (int i=1; i<=n; ++i) a[i]=X[i-1];
   partial_sum(a, a+n+1, pf);
   int ans=0;
   for (int l=1, r=1; r<=n; ++r){
      while (calc(l, r)>B) ++l;
      ans=max(ans, r-l+1);
   }
   return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 452 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 2 ms 860 KB Output is correct
3 Correct 10 ms 3380 KB Output is correct
4 Correct 11 ms 3416 KB Output is correct
5 Correct 5 ms 1624 KB Output is correct
6 Correct 5 ms 1628 KB Output is correct
7 Correct 8 ms 3244 KB Output is correct
8 Correct 9 ms 3164 KB Output is correct
9 Correct 4 ms 1488 KB Output is correct
10 Correct 5 ms 2908 KB Output is correct
11 Correct 10 ms 3264 KB Output is correct
12 Correct 10 ms 3420 KB Output is correct
13 Correct 5 ms 1628 KB Output is correct
14 Correct 5 ms 1648 KB Output is correct
15 Correct 7 ms 2540 KB Output is correct
16 Correct 8 ms 2652 KB Output is correct
17 Correct 9 ms 3124 KB Output is correct
18 Correct 9 ms 2908 KB Output is correct
19 Correct 9 ms 3164 KB Output is correct
20 Correct 9 ms 3264 KB Output is correct