結果

問題 No.2462 七人カノン
ユーザー PAKACHUPAKACHU
提出日時 2023-09-08 22:23:59
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,102 bytes
コンパイル時間 3,495 ms
コンパイル使用メモリ 134,148 KB
実行使用メモリ 12,212 KB
最終ジャッジ日時 2023-09-08 22:24:10
合計ジャッジ時間 9,614 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,968 KB
testcase_01 AC 3 ms
5,388 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 171 ms
8,928 KB
testcase_19 AC 169 ms
8,924 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const long long mod = 998244353;
const ll inf = 1LL << 60;
const int INF = 5e8;

int main()
{
    int n, q;
    cin >> n >> q;
    vector<vector<pair<int, int>>> v(n);
    vector<int> num(100010);
    while (q--) {
        int i, l, r;
        cin >> i >> l >> r;
        i--;
        r++;
        v[i].emplace_back(l, r);
        num[l]++;
        num[r]--;
    }

    for (int i = 0; i <= 100000; i++)
        num[i + 1] += num[i];

    vector<ld> s(100010);
    for (int i = 0; i <= 100000; i++) {
        if (num[i] == 0)
            continue;
        s[i] = (ld)1 / num[i];
    }

    for (int i = 0; i <= 100000; i++)
        s[i + 1] += s[i];

    vector<ld> ans(n);
    for (int i = 0; i < n; i++) {
        for (auto [l, r] : v[i]) {
            ans[i] += s[r] - s[l];
        }
    }

    for (int i = 0; i < n; i++) {
        printf("%.18Lf", ans[i]);
        cout << endl;
    }
}
0