結果

問題 No.3072 Sum of sqrt(x)
ユーザー 259_Momone259_Momone
提出日時 2020-09-12 23:01:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,478 bytes
コンパイル時間 3,241 ms
コンパイル使用メモリ 201,572 KB
実行使用メモリ 19,688 KB
最終ジャッジ日時 2023-08-30 19:32:27
合計ジャッジ時間 37,840 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 224 ms
19,480 KB
testcase_09 AC 561 ms
19,484 KB
testcase_10 AC 1,123 ms
19,372 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

int main(){
    using namespace std;
    // my fast in
    constexpr unsigned long buf_size = 3UL << 18UL;
    char buffer[buf_size];
    fread(buffer, 1, buf_size, stdin);
    unsigned long tmp_buf = 0;
    const auto &read = [&tmp_buf, &buffer] {
        const auto &M_reread_from_stdin = [&] {
            ptrdiff_t len = buf_size - tmp_buf;
            if (len > tmp_buf) return;
            memcpy(buffer, buffer + tmp_buf, len);
            char *tmp = buffer + len;
            fread(tmp, 1, buf_size - len, stdin);
            tmp_buf = 0;
        };
        unsigned long ret;
        from_chars_result tmp{};
        do {
            if (__builtin_expect(buf_size <= tmp_buf + 32, 0))
                M_reread_from_stdin();
            tmp = from_chars(begin(buffer) + tmp_buf, end(buffer), ret);
            tmp_buf = tmp.ptr - buffer + 1;
        } while (tmp.ec != errc{});
        return ret;
    };
    const auto &scan = [scan_impl = [&read](auto &x) -> decltype(auto) { return x = read(); }](
            auto &...args) { tuple<decltype(args)...>{scan_impl(args)...}; };
    // fast in kokomade
    unsigned long N;
    scan(N);
    vector<long double> v(N + 1);
    for(unsigned long i{1}; i <= N; ++i)v[i] = sqrtl(read());
    for(unsigned long i{1}; i <= N; i <<= 1UL)for(unsigned long j{2 * i}; j <= N; j += 2 * i)v[j] += v[j - i];
    for(unsigned long i{1}; i <= N; ++i)printf("%18.Lf\n", v[i] += v[i & (i - 1)]);
    return 0;
}
0