結果

問題 No.1808 Fullgold Alchemist
ユーザー zezerozezero
提出日時 2022-01-14 22:03:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 757 ms
コンパイル使用メモリ 83,552 KB
実行使用メモリ 6,324 KB
最終ジャッジ日時 2023-08-12 19:41:52
合計ジャッジ時間 3,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge7
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 38 ms
6,228 KB
testcase_06 AC 68 ms
6,152 KB
testcase_07 AC 66 ms
6,308 KB
testcase_08 AC 104 ms
6,204 KB
testcase_09 AC 94 ms
6,324 KB
testcase_10 AC 90 ms
6,192 KB
testcase_11 AC 87 ms
6,196 KB
testcase_12 AC 62 ms
6,312 KB
testcase_13 AC 64 ms
6,216 KB
testcase_14 AC 65 ms
6,200 KB
testcase_15 AC 65 ms
6,260 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 12 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 16 ms
4,380 KB
testcase_21 AC 7 ms
4,388 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 6 ms
4,380 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 13 ms
4,380 KB
testcase_27 AC 18 ms
4,376 KB
testcase_28 AC 80 ms
6,028 KB
testcase_29 AC 27 ms
4,376 KB
testcase_30 AC 24 ms
4,380 KB
testcase_31 AC 72 ms
5,628 KB
testcase_32 AC 44 ms
4,568 KB
testcase_33 AC 62 ms
5,208 KB
testcase_34 AC 77 ms
6,188 KB
testcase_35 AC 56 ms
4,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

void slove(){
   int n;
   ll m;
   cin >> n >> m;
   vector<ll> a(n);
   rep(i,n) cin >> a[i];
   auto can = [&](ll x){
     vector<ll> b = a;
     for (int i = 0; i < n;i++){
       if (b[i] < x*m) return false;
       if (i < n-1) b[i+1] += b[i]-x*m; 
     }
     return true;
   };
   ll l = -1,r = 1e9 + 7;
   while(r-l > 1){
     ll mid = (l+r)/2;
     if (can(mid)) l = mid;
     else r = mid;
   }
   cout << l << endl;
 
}
int main(){
  int tt = 1;
  //cin >> tt;
  while(tt--){
   slove();
  }
  return 0;
}
0