結果

問題 No.2462 七人カノン
ユーザー suisui
提出日時 2023-09-18 22:33:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 1,600 bytes
コンパイル時間 4,858 ms
コンパイル使用メモリ 262,744 KB
実行使用メモリ 6,220 KB
最終ジャッジ日時 2023-09-18 22:34:19
合計ジャッジ時間 16,720 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 217 ms
5,748 KB
testcase_14 AC 249 ms
5,928 KB
testcase_15 AC 224 ms
5,876 KB
testcase_16 AC 255 ms
5,872 KB
testcase_17 AC 258 ms
6,076 KB
testcase_18 AC 186 ms
4,732 KB
testcase_19 AC 175 ms
4,792 KB
testcase_20 AC 246 ms
5,924 KB
testcase_21 AC 246 ms
6,220 KB
testcase_22 AC 248 ms
5,920 KB
testcase_23 AC 249 ms
6,000 KB
testcase_24 AC 226 ms
5,284 KB
testcase_25 AC 260 ms
6,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i,a,b) for (int i = (int)(a) ; i < (int)(b+1); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define uni(v) v.erase(unique(v.begin(), v.end()), v.end());
using ll = long long;
using P = pair<int,int>;
using mint = modint998244353;
ostream& operator<< (ostream& os, const mint &x) {os << x.val(); return os;}
#ifdef LOCAL
    #include <debug.hpp>
    #define debug(...) debug::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
    #define debug(...) (static_cast<void>(0))
#endif

int main(){
    int n,q;
    cin >> n >> q;
    vector<pair<int,pair<int,int>>> ist;
    int t_max = 0;
    rep(_,q){
        int i,s,t;
        cin >> i >> s >> t;
        i--;
        ist.push_back({i,{s,t}});
        t_max = max(t_max,t);
    }
    vector<double> times(t_max+1,0);
    for(auto p : ist){
        int s = p.second.first;
        int t = p.second.second;
        times[s]++;
        times[t]--;
    }
    repn(i,1,t_max) times[i] += times[i-1];
    debug(times);
    repn(i,0,t_max) if(times[i] > 0) times[i] = 1/times[i];
    debug(times);
    repn(i,1,t_max) times[i] += times[i-1];
    debug(times);
    vector<double> ans(n,0);
    rep(i,q){
        int s = ist[i].second.first;
        int t = ist[i].second.second;
        int k = ist[i].first;
        ans[k] += times[t-1]-times[s-1];
    }
    rep(i,n) cout << fixed << setprecision(10) << ans[i] << endl;
    return 0;
}
0