結果

問題 No.1808 Fullgold Alchemist
ユーザー ace_amuroace_amuro
提出日時 2023-03-30 13:17:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 754 bytes
コンパイル時間 829 ms
コンパイル使用メモリ 81,528 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-10-21 23:55:31
合計ジャッジ時間 4,168 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,348 KB
testcase_05 AC 32 ms
4,384 KB
testcase_06 AC 63 ms
4,384 KB
testcase_07 AC 62 ms
4,384 KB
testcase_08 AC 95 ms
4,384 KB
testcase_09 AC 89 ms
4,384 KB
testcase_10 AC 88 ms
4,384 KB
testcase_11 AC 84 ms
4,384 KB
testcase_12 AC 57 ms
4,384 KB
testcase_13 AC 63 ms
4,384 KB
testcase_14 AC 69 ms
4,384 KB
testcase_15 AC 65 ms
4,384 KB
testcase_16 AC 4 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 12 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 17 ms
4,348 KB
testcase_21 AC 7 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 6 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
testcase_25 AC 4 ms
4,348 KB
testcase_26 AC 15 ms
4,348 KB
testcase_27 AC 20 ms
4,348 KB
testcase_28 AC 83 ms
4,348 KB
testcase_29 AC 29 ms
4,348 KB
testcase_30 AC 24 ms
4,348 KB
testcase_31 AC 79 ms
4,348 KB
testcase_32 AC 45 ms
4,348 KB
testcase_33 AC 69 ms
4,348 KB
testcase_34 AC 81 ms
4,348 KB
testcase_35 AC 60 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+5;
    while(l+1<r){
        int mid=(l+r)/2;
        if(check(mid)){
            l=mid;
        }
        else{
            r=mid;
        }
    }
    cout<<l<<endl;
    return 0;
}
0