답안 #936157

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
936157 2024-03-01T09:42:29 Z AtabayRajabli 쌀 창고 (IOI11_ricehub) C++17
68 / 100
22 ms 3676 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

long long p[100005];

long long cost(int l, int r)
{
  int m = (l + r) >> 1;
  int med = p[m] - p[m - 1];
  return med * (m - l) - (p[m - 1] - p[l - 1]) + p[r] - p[m] - med * (r - m);
}

int besthub(int R, int L, int X[], long long B)
{
  for(int i = 0; i < R; i++)
  {
    p[i + 1] = X[i] + p[i];
  }
  int r = 1;
 int ans = 0;
  for(int l = 1; l <= R; l++)
  {
    while(r <= R && cost(l, r) <= B)
    {
      ans = max(ans, r - l + 1);
      r++;
    }
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 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 2396 KB Output is correct
26 Correct 0 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 1 ms 2396 KB Output is correct
2 Correct 1 ms 2604 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2500 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 2396 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 2 ms 2652 KB Output is correct
2 Correct 2 ms 2604 KB Output is correct
3 Correct 12 ms 3676 KB Output is correct
4 Correct 9 ms 3676 KB Output is correct
5 Correct 5 ms 2908 KB Output is correct
6 Correct 4 ms 2908 KB Output is correct
7 Correct 8 ms 3420 KB Output is correct
8 Correct 8 ms 3248 KB Output is correct
9 Correct 4 ms 2908 KB Output is correct
10 Correct 4 ms 2908 KB Output is correct
11 Correct 9 ms 3676 KB Output is correct
12 Correct 22 ms 3664 KB Output is correct
13 Correct 5 ms 2908 KB Output is correct
14 Correct 10 ms 2908 KB Output is correct
15 Correct 9 ms 3416 KB Output is correct
16 Correct 7 ms 3420 KB Output is correct
17 Correct 15 ms 3496 KB Output is correct
18 Incorrect 8 ms 3432 KB Output isn't correct
19 Halted 0 ms 0 KB -