結果

問題 No.2462 七人カノン
ユーザー kotatsugamekotatsugame
提出日時 2023-09-08 21:26:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 69,980 KB
実行使用メモリ 9,356 KB
最終ジャッジ日時 2023-09-08 21:26:33
合計ジャッジ時間 8,854 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,560 KB
testcase_01 AC 5 ms
7,636 KB
testcase_02 AC 5 ms
7,724 KB
testcase_03 AC 6 ms
7,664 KB
testcase_04 AC 6 ms
7,736 KB
testcase_05 AC 6 ms
7,640 KB
testcase_06 AC 6 ms
7,656 KB
testcase_07 AC 6 ms
7,748 KB
testcase_08 AC 5 ms
7,752 KB
testcase_09 AC 5 ms
7,740 KB
testcase_10 AC 5 ms
7,732 KB
testcase_11 AC 6 ms
7,628 KB
testcase_12 AC 6 ms
7,644 KB
testcase_13 AC 76 ms
8,908 KB
testcase_14 AC 85 ms
9,176 KB
testcase_15 AC 77 ms
8,976 KB
testcase_16 AC 87 ms
9,180 KB
testcase_17 AC 88 ms
9,296 KB
testcase_18 AC 57 ms
7,848 KB
testcase_19 AC 57 ms
7,652 KB
testcase_20 AC 83 ms
9,276 KB
testcase_21 AC 82 ms
9,336 KB
testcase_22 AC 86 ms
9,144 KB
testcase_23 AC 84 ms
9,264 KB
testcase_24 AC 75 ms
9,204 KB
testcase_25 AC 89 ms
9,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cassert>
using namespace std;
int N,Q;
int cnt[1<<17];
int I[1<<17],S[1<<17],T[1<<17];
long double X[1<<17];
long double ans[1<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>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<1<<17;i++)cnt[i]+=cnt[i-1];
	for(int i=0;i+1<1<<17;i++)
	{
		X[i+1]=X[i];
		if(cnt[i]>0)X[i+1]+=(long double)1/cnt[i];
	}
	for(int i=0;i<Q;i++)ans[I[i]]+=X[T[i]]-X[S[i]];
	for(int i=0;i<N;i++)cout<<fixed<<setprecision(16)<<ans[i]<<"\n";
}
0