結果

問題 No.3072 Sum of sqrt(x)
ユーザー chocoruskchocorusk
提出日時 2020-09-12 22:29:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,099 bytes
コンパイル時間 2,750 ms
コンパイル使用メモリ 136,068 KB
実行使用メモリ 52,044 KB
最終ジャッジ日時 2024-06-10 18:59:50
合計ジャッジ時間 97,816 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
36,480 KB
testcase_01 AC 15 ms
36,476 KB
testcase_02 AC 15 ms
36,480 KB
testcase_03 AC 25 ms
36,480 KB
testcase_04 AC 25 ms
36,480 KB
testcase_05 AC 25 ms
36,352 KB
testcase_06 AC 25 ms
36,352 KB
testcase_07 WA -
testcase_08 AC 635 ms
51,840 KB
testcase_09 AC 998 ms
51,712 KB
testcase_10 OLE -
testcase_11 AC 1,585 ms
51,840 KB
testcase_12 AC 1,701 ms
51,828 KB
testcase_13 AC 1,706 ms
51,712 KB
testcase_14 AC 1,772 ms
51,840 KB
testcase_15 AC 1,673 ms
51,712 KB
testcase_16 AC 1,782 ms
51,840 KB
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 AC 1,495 ms
51,712 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main()
{
    int n;
    scanf("%d", &n);
    vector<pair<ll, int>> v(n);
    for(int i=0; i<n; i++){
        ll x;
        scanf("%lld", &x);
        v[i]=make_pair(x, i);
    }
    sort(v.begin(), v.end());
    long double seg[1<<21]={};
    int sz=1;
    while(sz<n) sz<<=1;
    auto add=[&](int l, int r, long double x){
        l+=sz, r+=sz;
        for(;l<r; l>>=1, r>>=1){
            if(r&1) seg[--r]+=x;
            if(l&1) seg[l++]+=x;
        }
    };
    auto calc=[&](int i){
        i+=sz;
        long double ret=seg[i];
        while(i>1){
            i>>=1;
            ret+=seg[i];
        }
        return ret;
    };
    for(int i=0; i<n; i++){
        add(v[i].second, n, sqrt((long double)v[i].first));
    }
    for(int i=0; i<n; i++){
        long double ans=calc(i);
        if(ans<1e1) printf("%.17Lf\n", ans);
        else if(ans<1e2) printf("%.16Lf\n", ans);
        else if(ans<1e3) printf("%.15Lf\n", ans);
        else if(ans<1e4) printf("%.14Lf\n", ans);
        else if(ans<1e5) printf("%.13Lf\n", ans);
        else if(ans<1e6) printf("%.12Lf\n", ans);
        else if(ans<1e7) printf("%.11Lf\n", ans);
        else if(ans<1e8) printf("%.10Lf\n", ans);
        else if(ans<1e9) printf("%.9Lf\n", ans);
        else if(ans<1e10) printf("%.8Lf\n", ans);
        else if(ans<1e11) printf("%.7Lf\n", ans);
        else if(ans<1e12) printf("%.6Lf\n", ans);
        else if(ans<1e13) printf("%.5Lf\n", ans);
        else if(ans<1e14) printf("%.4Lf\n", ans);
        else printf("%.3Lf\n", ans);
    }
    return 0;
}
0