結果

問題 No.1139 Slime Race
ユーザー tabae326tabae326
提出日時 2020-07-31 22:48:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 224 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 168,260 KB
実行使用メモリ 4,852 KB
最終ジャッジ日時 2023-09-15 02:57:19
合計ジャッジ時間 5,173 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 205 ms
4,600 KB
testcase_11 AC 198 ms
4,852 KB
testcase_12 AC 221 ms
4,676 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 204 ms
4,620 KB
testcase_15 AC 179 ms
4,376 KB
testcase_16 AC 217 ms
4,604 KB
testcase_17 AC 207 ms
4,612 KB
testcase_18 AC 158 ms
4,564 KB
testcase_19 AC 111 ms
4,380 KB
testcase_20 AC 107 ms
4,376 KB
testcase_21 AC 158 ms
4,380 KB
testcase_22 AC 199 ms
4,604 KB
testcase_23 AC 224 ms
4,552 KB
testcase_24 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n, d;
    cin >> n >> d;
    vector<ll> x(n), v(n);
    rep(i, 0, n) cin >> x[i];
    rep(i, 0, n) cin >> v[i];
    double l = 0, r = 1e20;
    rep(itr, 0, 1000) {
        double m = (l + r) / 2;
        double sum = 0;
        rep(i, 0, n) sum += v[i] * m;
        if(sum >= d) r = m;
        else l = m;
    }
    cerr << r << endl;
    cerr << r - (ll)r << endl;
    if(r - (ll)r < 1e-12) cout << (ll)r << endl;
    else cout << (ll)r + 1 << endl;
    return 0;
}
0