結果

問題 No.2009 Drunkers' Contest
ユーザー 259_Momone259_Momone
提出日時 2022-07-15 21:46:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 1,022 bytes
コンパイル時間 12,300 ms
コンパイル使用メモリ 512,880 KB
実行使用メモリ 32,720 KB
最終ジャッジ日時 2023-09-10 01:17:13
合計ジャッジ時間 20,890 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,356 KB
testcase_01 AC 2 ms
4,356 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,356 KB
testcase_04 AC 2 ms
4,356 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,356 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 1 ms
4,356 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,356 KB
testcase_12 AC 1 ms
4,356 KB
testcase_13 AC 1 ms
4,356 KB
testcase_14 AC 3 ms
4,356 KB
testcase_15 AC 3 ms
4,352 KB
testcase_16 AC 3 ms
4,356 KB
testcase_17 AC 4 ms
4,352 KB
testcase_18 AC 4 ms
4,360 KB
testcase_19 AC 5 ms
4,356 KB
testcase_20 AC 5 ms
4,352 KB
testcase_21 AC 5 ms
4,352 KB
testcase_22 AC 6 ms
4,356 KB
testcase_23 AC 5 ms
4,352 KB
testcase_24 AC 175 ms
15,768 KB
testcase_25 AC 176 ms
15,616 KB
testcase_26 AC 174 ms
15,720 KB
testcase_27 AC 176 ms
15,660 KB
testcase_28 AC 174 ms
15,640 KB
testcase_29 AC 176 ms
15,704 KB
testcase_30 AC 174 ms
15,564 KB
testcase_31 AC 177 ms
15,708 KB
testcase_32 AC 178 ms
15,560 KB
testcase_33 AC 178 ms
15,564 KB
testcase_34 AC 160 ms
15,608 KB
testcase_35 AC 159 ms
15,632 KB
testcase_36 AC 160 ms
15,612 KB
testcase_37 AC 159 ms
15,648 KB
testcase_38 AC 161 ms
15,716 KB
testcase_39 AC 160 ms
15,592 KB
testcase_40 AC 160 ms
15,628 KB
testcase_41 AC 159 ms
15,832 KB
testcase_42 AC 157 ms
15,656 KB
testcase_43 AC 158 ms
15,612 KB
testcase_44 AC 181 ms
15,616 KB
testcase_45 AC 181 ms
15,760 KB
testcase_46 AC 128 ms
15,560 KB
testcase_47 AC 116 ms
32,720 KB
testcase_48 AC 116 ms
32,044 KB
testcase_49 AC 115 ms
32,368 KB
testcase_50 AC 116 ms
32,172 KB
testcase_51 AC 118 ms
32,644 KB
testcase_52 AC 114 ms
24,824 KB
testcase_53 AC 136 ms
24,268 KB
testcase_54 AC 138 ms
25,068 KB
testcase_55 AC 128 ms
16,660 KB
testcase_56 AC 125 ms
16,040 KB
testcase_57 AC 133 ms
25,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  main.cpp:2:
メンバ関数 ‘void boost::multiprecision::backends::cpp_int_base<MinBits, MaxBits, boost::multiprecision::signed_magnitude, Checked, Allocator, false>::resize(std::size_t, std::size_t) [with long unsigned int MinBits = 0; long unsigned int MaxBits = 18446744073709551615; boost::multiprecision::cpp_int_check_type Checked = boost::multiprecision::unchecked; Allocator = std::allocator<long long unsigned int>]’ 内,
    inlined from ‘constexpr void boost::multiprecision::backends::add_unsigned(CppInt1&, const CppInt2&, const boost::multiprecision::limb_type&) [with CppInt1 = cpp_int_backend<>; CppInt2 = cpp_int_backend<>]’ at /boost_git/boost/multiprecision/cpp_int/add.hpp:50:20,
    inlined from ‘constexpr typename std::enable_if<(! boost::multiprecision::backends::is_trivial_cpp_int<boost::multiprecision::backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value)>::type boost::multiprecision::backends::eval_add(cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>&, const boost::multiprecision::limb_type&) [with long unsigned int MinBits1 = 0; long unsigned int MaxBits1 = 0; boost::multiprecision::cpp_integer_type SignType1 = boost::multiprecision::signed_magnitude; boost::multiprecision::cpp_int_check_type Checked1 = boost::multiprecision::unchecked; Allocator1 = std::allocator<long long unsigned int>]’ at /boost_git/boost/multiprecision/cpp_int/add.hpp:141:19,
    inlined from ‘void boost::multiprecision::backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>::do_assign_string(const char*, const std::integral_constant<bool, false>&) [with long unsigned int MinBits = 0; long unsigned int MaxBits = 0; boost::multiprecision::cpp_integer_type SignType = boost::multiprecision::signed_magnitude; boost::multiprecision::cpp_int_check_type Checked = boost::multiprecision::unchecked; Allocator = std::allocator<long long unsigned int>]’ at /boost_git/boos

ソースコード

diff #

#include <bits/extc++.h>
#include <boost/multiprecision/cpp_int.hpp>

int main(){
    using namespace std;
    using bigint = boost::multiprecision::cpp_int;
    unsigned long N;
    cin >> N;
    vector<pair<bigint, bigint>> problems(N);
    for(auto&& [a, _] : problems)cin >> a;
    for(auto&& [_, b] : problems)cin >> b;
    reverse(begin(problems), end(problems));
    vector<pair<bigint, bigint>> stack;
    while(!empty(problems)){
        auto [a, b]{problems.back()};
        problems.pop_back();
        while(!empty(stack) && stack.back().first * b >= stack.back().second * a){
            a += stack.back().first;
            b += stack.back().second;
            stack.pop_back();
        }
        stack.emplace_back(a, b);
    }
    long double ans{};
    for(const auto& [a, b] : stack)ans += a < b ? static_cast<long double>(a) + static_cast<long double>(b) : 2 * sqrt(static_cast<long double>(a)) * sqrt(static_cast<long double>(b));
    cout << fixed << setprecision(30) << ans << endl;
    return 0;
}
0