結果

問題 No.1808 Fullgold Alchemist
ユーザー 👑 CleyL
提出日時 2022-01-24 00:16:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 70,028 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 07:45:42
合計ジャッジ時間 3,931 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
    long long n,m;cin>>n>>m;
    vector<long long> A(n);
    for(int i = 0; n > i; i++){
        cin>>A[i];
    }
    long long mn = 0;
    long long mx = A[0]+1;
    while(mx-mn > 1){
        long long ce = (mn+mx)/2;
        long long 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