結果

問題 No.1808 Fullgold Alchemist
ユーザー SSRSSSRS
提出日時 2022-01-14 21:24:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 166,836 KB
実行使用メモリ 5,556 KB
最終ジャッジ日時 2023-08-12 17:32:10
合計ジャッジ時間 4,708 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 35 ms
5,492 KB
testcase_06 AC 61 ms
5,544 KB
testcase_07 AC 61 ms
5,432 KB
testcase_08 AC 98 ms
5,548 KB
testcase_09 AC 99 ms
5,556 KB
testcase_10 AC 97 ms
5,484 KB
testcase_11 AC 93 ms
5,428 KB
testcase_12 AC 59 ms
5,376 KB
testcase_13 AC 63 ms
5,488 KB
testcase_14 AC 62 ms
5,484 KB
testcase_15 AC 63 ms
5,488 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 11 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 16 ms
4,380 KB
testcase_21 AC 7 ms
4,376 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 5 ms
4,376 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 13 ms
4,380 KB
testcase_27 AC 18 ms
4,380 KB
testcase_28 AC 78 ms
5,340 KB
testcase_29 AC 26 ms
4,380 KB
testcase_30 AC 24 ms
4,380 KB
testcase_31 AC 69 ms
4,848 KB
testcase_32 AC 42 ms
4,376 KB
testcase_33 AC 58 ms
4,692 KB
testcase_34 AC 77 ms
5,176 KB
testcase_35 AC 53 ms
4,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  int tv = 0, fv = 1000000001;
  while (fv - tv > 1){
    int mid = (tv + fv) / 2;
    bool ok = true;
    vector<long long> B(N);
    for (int i = 0; i < N; i++){
      B[i] = A[i];
    }
    for (int i = 0; i < N; i++){
      if (B[i] < mid){
        ok = false;
        break;
      }
      if (i < N - 1){
        B[i + 1] += B[i] - mid;
      }
    }
    if (ok){
      tv = mid;
    } else {
      fv = mid;
    }
  }
  cout << tv / M << endl;
}
0