結果

問題 No.1808 Fullgold Alchemist
ユーザー se1ka2se1ka2
提出日時 2022-01-14 21:30:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 63,888 KB
実行使用メモリ 5,204 KB
最終ジャッジ日時 2023-08-12 17:44:23
合計ジャッジ時間 3,522 ms
ジャッジサーバーID
(参考情報)
judge2 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 30 ms
4,972 KB
testcase_06 AC 59 ms
4,892 KB
testcase_07 AC 58 ms
4,972 KB
testcase_08 AC 87 ms
5,088 KB
testcase_09 AC 83 ms
4,892 KB
testcase_10 AC 83 ms
4,896 KB
testcase_11 AC 78 ms
4,972 KB
testcase_12 AC 54 ms
5,204 KB
testcase_13 AC 55 ms
4,892 KB
testcase_14 AC 55 ms
5,092 KB
testcase_15 AC 55 ms
4,972 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 10 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 15 ms
4,380 KB
testcase_21 AC 6 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 5 ms
4,376 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 12 ms
4,376 KB
testcase_27 AC 16 ms
4,376 KB
testcase_28 AC 70 ms
4,796 KB
testcase_29 AC 23 ms
4,380 KB
testcase_30 AC 21 ms
4,380 KB
testcase_31 AC 63 ms
4,700 KB
testcase_32 AC 39 ms
4,384 KB
testcase_33 AC 53 ms
4,396 KB
testcase_34 AC 68 ms
4,772 KB
testcase_35 AC 48 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    ll m;
    cin >> n >> m;
    ll a[200005];
    for(int i = 0; i < n; i++) cin >> a[i];
    ll left = -1, right = 1000000002;
    while(right - left > 1){
        ll mid = (right + left) / 2;
        ll s = 0;
        bool f = true;
        for(int i = 0; i < n; i++){
            s += a[i];
            if(s < mid * m){
                f = false;
                break;
            }
            s -= mid * m;
        }
        if(f) left = mid;
        else right = mid;
    }
    cout << left << endl;
}
0