結果

問題 No.1808 Fullgold Alchemist
ユーザー 👑 CleyL
提出日時 2022-01-24 00:02:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 69,532 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-30 07:24:22
合計ジャッジ時間 3,934 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n,m;cin>>n>>m;
    vector<int> A(n);
    for(int i = 0; n > i; i++){
        cin>>A[i];
    }
    int mn = 0;
    int mx = A[0]+1;
    while(mx-mn > 1){
        int ce = (mn+mx)/2;
        int nw = 0;
        bool ok = true;
        for(int i = 0; n > i; i++){
            if(A[i]+nw < ce){
                ok = false;
                break;
            }
            nw = A[i]+nw-ce;
        }
        if(ok){
            mn = ce;
        }else{
            mx = ce;
        }
    }
    cout << mn/m << endl;
}
0