結果

問題 No.2462 七人カノン
ユーザー ldsybldsyb
提出日時 2023-09-08 22:47:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 1,100 bytes
コンパイル時間 6,432 ms
コンパイル使用メモリ 262,700 KB
実行使用メモリ 13,648 KB
最終ジャッジ日時 2023-09-08 22:48:14
合計ジャッジ時間 16,838 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
9,536 KB
testcase_01 AC 26 ms
9,480 KB
testcase_02 AC 35 ms
9,616 KB
testcase_03 AC 9 ms
9,540 KB
testcase_04 AC 9 ms
9,692 KB
testcase_05 AC 9 ms
9,688 KB
testcase_06 AC 9 ms
9,540 KB
testcase_07 AC 9 ms
9,536 KB
testcase_08 AC 8 ms
9,584 KB
testcase_09 AC 8 ms
9,616 KB
testcase_10 AC 9 ms
9,688 KB
testcase_11 AC 9 ms
9,620 KB
testcase_12 AC 9 ms
9,476 KB
testcase_13 AC 242 ms
13,048 KB
testcase_14 AC 276 ms
13,396 KB
testcase_15 AC 248 ms
13,276 KB
testcase_16 AC 281 ms
13,632 KB
testcase_17 AC 285 ms
13,284 KB
testcase_18 AC 188 ms
11,060 KB
testcase_19 AC 192 ms
11,116 KB
testcase_20 AC 266 ms
13,308 KB
testcase_21 AC 272 ms
13,212 KB
testcase_22 AC 273 ms
13,168 KB
testcase_23 AC 270 ms
13,168 KB
testcase_24 AC 238 ms
12,480 KB
testcase_25 AC 292 ms
13,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

long double op(long double a, long double b)
{
    return a + b;
}
long double e()
{
    return 0;
}

int main()
{
    int64_t n, q;
    cin >> n >> q;
    vector<int64_t> is(q), ss(q), ts(q);
    for (int64_t i = 0; i < q; i++)
    {
        cin >> is[i] >> ss[i] >> ts[i];
        is[i]--;
    }

    vector<int64_t> cnt(100001, 0);
    for (int64_t i = 0; i < q; i++)
    {
        cnt[ss[i]]++;
        cnt[ts[i]]--;
    }
    for (int64_t i = 1; i < cnt.size(); i++)
    {
        cnt[i] += cnt[i - 1];
    }

    vector<long double> xs(cnt.size(), 0);
    for (int64_t i = 0; i < cnt.size(); i++)
    {
        xs[i] = (long double)(1) / cnt[i];
    }

    segtree<long double, op, e> seg(xs);

    vector<long double> ans(n, 0);
    for (int64_t i = 0; i < q; i++)
    {
        ans[is[i]] += seg.prod(ss[i], ts[i]);
    }

    for (auto &&x : ans)
    {
        cout << fixed << setprecision(20) << x << endl;
    }

    return 0;
}
0