結果

問題 No.1808 Fullgold Alchemist
ユーザー tnakao0123tnakao0123
提出日時 2022-01-15 19:38:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 696 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 41,772 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 17:39:42
合計ジャッジ時間 2,143 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 20 ms
5,376 KB
testcase_06 AC 25 ms
5,376 KB
testcase_07 AC 25 ms
5,376 KB
testcase_08 AC 29 ms
5,376 KB
testcase_09 AC 29 ms
5,376 KB
testcase_10 AC 29 ms
5,376 KB
testcase_11 AC 28 ms
5,376 KB
testcase_12 AC 28 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1808.cc:  No.1808 Fullgold Alchemist - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int INF = 1 << 30;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", as + i);

  int minav = INF;
  for (int i = n - 1; i >= 0;) {
    int j = i;
    ll sum = 0;
    while (j >= 0 && sum <= (ll)as[j] * (i - j))
      sum += as[j--];

    int av = sum / (i - j);
    minav = min(minav, av);

    i = j;
  }

  printf("%d\n", minav / m);
  return 0;
}
0