結果

問題 No.1808 Fullgold Alchemist
ユーザー Nikita SkybytskyiNikita Skybytskyi
提出日時 2022-01-14 21:32:18
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 697 bytes
コンパイル時間 3,759 ms
コンパイル使用メモリ 132,864 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-12 17:47:37
合計ジャッジ時間 5,905 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 14 ms
4,384 KB
testcase_06 AC 20 ms
4,380 KB
testcase_07 AC 19 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 22 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1 ms
4,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 #

/*
 * Author: nskybytskyi
 * Time:   2022-01-13 15:08:45
 */

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0)->sync_with_stdio(0);

  int n, m;
  cin >> n >> m;

  vector<int> a(n);
  for (auto& ai : a) {
    cin >> ai;
  }

  auto can = [&] (int mi) -> bool {
    int balance = 0;
    for (auto ai : a) {
      ai += balance;
      if (ai < mi) {
        return false;
      } else {
        balance = ai - mi;
      }
    }
    return true;
  };

  int lo = 0, hi = *max_element(a.begin(), a.end()) + 1;
  while (hi - lo > 1) {
    int mi = (lo + hi) >> 1;
    if (can(mi)) {
      lo = mi;
    } else {
      hi = mi;
    }
  }
  cout << lo / m << "\n";

  return 0;
}
0