답안 #1003216

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003216 2024-06-20T07:53:30 Z HasanV11010238 쌀 창고 (IOI11_ricehub) C++17
68 / 100
1000 ms 3456 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000000000
using namespace std;
vector<ll> pr, x;
int besthub(int R, int L, int X[], long long B)
{
  pr.assign(R + 1, 0), x.assign(R + 1, 0);
  for (int i = 1; i <= R; i++){
    x[i] = X[i - 1];
    pr[i] = pr[i - 1] + x[i];
  }
  ll ans = 0;
  for (int i = 1; i <= R; i++){
    ll co = 0;
    ll l = i, r = i;
    while (true){
      ll col, cor;
      if (l == 1){
        col = INF;
      }
      else{
        col = x[i] - x[l - 1];
      }
      if (r == R){
        cor = INF;
      }
      else{
        cor = x[r + 1] - x[i];
      }
      if (co + min(col, cor) > B){
        break;
      }
      else if (col < cor){
        co += col;
        l--;
      }
      else{
        co += cor;
        r++;
      }
    }
    ans = max(ans, r - l + 1);
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 352 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 1 ms 604 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 0 ms 348 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 0 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 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 456 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 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 348 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 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 29 ms 576 KB Output is correct
24 Correct 26 ms 348 KB Output is correct
25 Correct 71 ms 344 KB Output is correct
26 Correct 77 ms 348 KB Output is correct
27 Correct 18 ms 348 KB Output is correct
28 Correct 18 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 860 KB Output is correct
2 Correct 4 ms 860 KB Output is correct
3 Execution timed out 1087 ms 3456 KB Time limit exceeded
4 Halted 0 ms 0 KB -