結果

問題 No.1139 Slime Race
ユーザー DriceDrice
提出日時 2020-07-31 21:54:17
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 31,580 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 02:53:24
合計ジャッジ時間 1,774 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 22 ms
4,380 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 24 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 21 ms
4,376 KB
testcase_15 AC 21 ms
4,380 KB
testcase_16 AC 24 ms
4,376 KB
testcase_17 AC 20 ms
4,380 KB
testcase_18 AC 18 ms
4,376 KB
testcase_19 AC 12 ms
4,380 KB
testcase_20 AC 12 ms
4,380 KB
testcase_21 AC 17 ms
4,380 KB
testcase_22 AC 21 ms
4,376 KB
testcase_23 AC 26 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>

int main(){
    int n; long long d;
    scanf("%d%lld",&n,&d);
    for(int i = 1; i <= n; i++){
        int x;
        scanf("%d",&x);
    }
    long long sum = 0;
    for(int i = 1; i <= n; i++){
        long long u;
        scanf("%lld",&u);
        sum += u;
    }
    long long inf = 1e17+7;
    long long L = 1, R = inf/sum;
    //printf("L = %lld, R = %lld\n",L,R);
    long long res = -1;
    //overflow...
    while(L<=R){
        long long M = (L+R)/2;
        if(sum*M>=d){
            res = M;
            R = M-1;
        }
        else L = M+1;
    }
    printf("%lld\n",res);
    return 0;
}
0