結果

問題 No.2462 七人カノン
ユーザー t98slidert98slider
提出日時 2023-09-08 21:34:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 1,542 ms
コンパイル使用メモリ 173,240 KB
実行使用メモリ 6,248 KB
最終ジャッジ日時 2023-09-08 21:34:25
合計ジャッジ時間 9,366 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,388 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 4 ms
4,404 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 4 ms
4,404 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 68 ms
5,964 KB
testcase_14 AC 77 ms
6,228 KB
testcase_15 AC 69 ms
5,848 KB
testcase_16 AC 80 ms
6,228 KB
testcase_17 AC 80 ms
6,244 KB
testcase_18 AC 52 ms
4,800 KB
testcase_19 AC 52 ms
4,832 KB
testcase_20 AC 75 ms
6,248 KB
testcase_21 AC 75 ms
6,132 KB
testcase_22 AC 77 ms
6,184 KB
testcase_23 AC 75 ms
6,184 KB
testcase_24 AC 67 ms
5,584 KB
testcase_25 AC 81 ms
6,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q, m = 100000;
    cin >> n >> q;
    vector<int> imos(m + 1);
    vector<tuple<int,int,int>> a(q);
    for(int i = 0; i < q; i++){
        int t, l, r;
        cin >> t >> l >> r;
        t--;
        a[i] = make_tuple(t, l, r);
        imos[l]++;
        imos[r]--;
    }
    vector<double> s(m + 1);
    for(int i = 0; i < m; i++){
        imos[i + 1] += imos[i];
        s[i + 1] = s[i] + (imos[i] != 0 ? 1.0 / imos[i] : 0);
    }
    vector<double> ans(n);
    for(auto &&tup : a){
        int t, l, r;
        tie(t, l, r) = tup;
        ans[t] += s[r] - s[l];
    }
    cout << fixed << setprecision(15);
    for(int i = 0; i < n; i++){
        cout << ans[i] << '\n';
    }
}
0