結果

問題 No.2462 七人カノン
ユーザー cho435
提出日時 2023-09-08 22:55:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 3,654 ms
コンパイル使用メモリ 254,888 KB
最終ジャッジ日時 2025-02-16 20:18:59
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;

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

int main(){
	int n,q;
	cin>>n>>q;
	vector<int> I(q),S(q),T(q);
	rep(i,q) cin>>I.at(i)>>S.at(i)>>T.at(i);
	rep(i,q) I.at(i)--;
	vector<ll> sm(1e5+1,0);
	rep(i,q){
		sm.at(S.at(i))++;
		sm.at(T.at(i))--;
	}
	rep(i,1e5) sm.at(i+1)+=sm.at(i);
	atcoder::segtree<double,op,e> seg(1e5);
	rep(i,1e5) if(sm.at(i)>0) seg.set(i,(double)1/sm.at(i));
	vector<double> ans(n,0);
	rep(i,q){
		ans.at(I.at(i))+=seg.prod(S.at(i),T.at(i));
	}
	cout<<fixed<<setprecision(10);
	rep(i,n) cout<<ans.at(i)<<"\n";
}
0