結果

問題 No.2462 七人カノン
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-16 11:29:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 2,215 ms
コンパイル使用メモリ 198,576 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 11:30:04
合計ジャッジ時間 10,104 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 3 ms
6,944 KB
testcase_03 AC 4 ms
6,940 KB
testcase_04 AC 4 ms
6,940 KB
testcase_05 AC 3 ms
6,944 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 4 ms
6,940 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 68 ms
6,944 KB
testcase_14 AC 74 ms
6,940 KB
testcase_15 AC 69 ms
6,944 KB
testcase_16 AC 79 ms
6,944 KB
testcase_17 AC 81 ms
6,944 KB
testcase_18 AC 49 ms
6,940 KB
testcase_19 AC 50 ms
6,944 KB
testcase_20 AC 76 ms
6,944 KB
testcase_21 AC 71 ms
6,940 KB
testcase_22 AC 80 ms
6,940 KB
testcase_23 AC 78 ms
6,940 KB
testcase_24 AC 67 ms
6,940 KB
testcase_25 AC 88 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    int n, q;
    cin >> n >> q;
    const int M = 1e5 + 5;
    vector<int> cnt(M);
    vector<int> I(q), S(q), T(q);
    for (int i = 0; i < q; i++) {
        cin >> I[i] >> S[i] >> T[i];
        I[i]--;
        cnt[S[i]]++;
        cnt[T[i]]--;
    }
    for (int i = 1; i < M; i++) {
        cnt[i] += cnt[i - 1];
    }
    vector<double> cum(M + 1);
    for (int i = 0; i < M; i++) {
        if (cnt[i] == 0) {
            cum[i + 1] = cum[i];
        } else {
            cum[i + 1] = cum[i] + (1.0 / cnt[i]);
        }
    }
    vector<double> ans(n);
    for (int i = 0; i < q; i++) {
        ans[I[i]] += cum[T[i]] - cum[S[i]];
    }
    cout << setprecision(16) << fixed;
    for (int i = 0; i < n; i++) {
        cout << ans[i] << "\n";
    }
}
0