結果
問題 |
No.1139 Slime Race
|
ユーザー |
|
提出日時 | 2020-07-31 21:40:12 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 198 ms / 2,000 ms |
コード長 | 856 bytes |
コンパイル時間 | 2,931 ms |
コンパイル使用メモリ | 194,528 KB |
最終ジャッジ日時 | 2025-01-12 09:31:57 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> /** * @title 128-bit int * @docs int128.md */ #ifdef __SIZEOF_INT128__ using uint128_t = __uint128_t; using int128_t = __int128_t; #else #include <boost/multiprecision/cpp_int.hpp> using uint128_t = boost::multiprecision::uint128_t; using int128_t = boost::multiprecision::int128_t; #endif int main(){ int64_t N, D; std::cin >> N >> D; std::vector<int64_t> x(N), v(N); for(int i = 0; i < N; ++i) std::cin >> x[i]; for(int i = 0; i < N; ++i) std::cin >> v[i]; auto f = [&](int64_t T) -> int128_t{ int128_t ret = std::accumulate(v.begin(), v.end(), 0LL); ret *= T; return ret; }; int64_t lb = 0, ub = 1e18; while(std::abs(lb - ub) > 1){ auto mid = (lb + ub) / 2; if(f(mid) >= D){ ub = mid; }else{ lb = mid; } } std::cout << ub << "\n"; return 0; }