結果
| 問題 |
No.2462 七人カノン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-08 21:26:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 600 bytes |
| コンパイル時間 | 597 ms |
| コンパイル使用メモリ | 69,356 KB |
| 実行使用メモリ | 9,196 KB |
| 最終ジャッジ日時 | 2024-06-26 14:16:02 |
| 合計ジャッジ時間 | 7,927 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#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";
}