結果

問題 No.1808 Fullgold Alchemist
ユーザー ace_amuroace_amuro
提出日時 2023-03-30 13:16:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 81,548 KB
実行使用メモリ 4,412 KB
最終ジャッジ日時 2023-10-21 23:55:10
合計ジャッジ時間 6,226 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 29 ms
4,412 KB
testcase_06 AC 59 ms
4,412 KB
testcase_07 AC 57 ms
4,412 KB
testcase_08 WA -
testcase_09 AC 82 ms
4,412 KB
testcase_10 AC 82 ms
4,412 KB
testcase_11 AC 74 ms
4,412 KB
testcase_12 AC 52 ms
4,412 KB
testcase_13 AC 55 ms
4,412 KB
testcase_14 AC 61 ms
4,412 KB
testcase_15 AC 56 ms
4,412 KB
testcase_16 AC 4 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 11 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 16 ms
4,348 KB
testcase_21 AC 6 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 5 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
testcase_25 AC 4 ms
4,348 KB
testcase_26 AC 13 ms
4,348 KB
testcase_27 AC 18 ms
4,348 KB
testcase_28 AC 74 ms
4,348 KB
testcase_29 AC 25 ms
4,348 KB
testcase_30 AC 21 ms
4,348 KB
testcase_31 AC 74 ms
4,348 KB
testcase_32 AC 42 ms
4,348 KB
testcase_33 AC 63 ms
4,348 KB
testcase_34 AC 72 ms
4,348 KB
testcase_35 AC 53 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<ctime>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
typedef long long LL;
const int MR=2e5+10;
int n,m,a[MR];
bool check(LL x){
    LL r=0;
    for(int i=1;i<=n;i++){
        if(a[i] >= m*x){
            r+=a[i]-m*x;
        }
        else{
            r-=m*x-a[i];
            if(r<0) return false;
        }
    }
    return true;
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>a[i];
    int l=0,r=1e9;
    while(l+1<r){
        int mid=(l+r)/2;
        if(check(mid)){
            l=mid;
        }
        else{
            r=mid;
        }
    }
    cout<<l<<endl;
    return 0;
}
0