結果

問題 No.3072 Sum of sqrt(x)
ユーザー chocoruskchocorusk
提出日時 2020-09-12 22:28:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,098 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 132,984 KB
実行使用メモリ 51,876 KB
最終ジャッジ日時 2023-08-30 19:24:26
合計ジャッジ時間 13,007 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
36,252 KB
testcase_01 AC 11 ms
36,188 KB
testcase_02 AC 11 ms
36,328 KB
testcase_03 AC 10 ms
36,264 KB
testcase_04 AC 10 ms
36,280 KB
testcase_05 AC 11 ms
36,484 KB
testcase_06 AC 10 ms
36,208 KB
testcase_07 WA -
testcase_08 AC 667 ms
51,768 KB
testcase_09 AC 954 ms
51,876 KB
testcase_10 AC 1,564 ms
51,592 KB
testcase_11 AC 1,544 ms
51,456 KB
testcase_12 AC 1,696 ms
51,188 KB
testcase_13 TLE -
testcase_14 AC 1,646 ms
51,500 KB
testcase_15 AC 1,655 ms
51,452 KB
testcase_16 AC 1,644 ms
51,332 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,433 ms
51,444 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("%.16Lf\n", ans);
        else if(ans<1e2) printf("%.15Lf\n", ans);
        else if(ans<1e3) printf("%.14Lf\n", ans);
        else if(ans<1e4) printf("%.13Lf\n", ans);
        else if(ans<1e5) printf("%.12Lf\n", ans);
        else if(ans<1e6) printf("%.11Lf\n", ans);
        else if(ans<1e7) printf("%.10Lf\n", ans);
        else if(ans<1e8) printf("%.9Lf\n", ans);
        else if(ans<1e9) printf("%.8Lf\n", ans);
        else if(ans<1e10) printf("%.7Lf\n", ans);
        else if(ans<1e11) printf("%.6Lf\n", ans);
        else if(ans<1e12) printf("%.5Lf\n", ans);
        else if(ans<1e13) printf("%.4Lf\n", ans);
        else if(ans<1e14) printf("%.3Lf\n", ans);
        else printf("%.2Lf\n", ans);
    }
    return 0;
}
0