結果
| 問題 |
No.2462 七人カノン
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2023-09-08 22:47:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 248 ms / 2,000 ms |
| コード長 | 1,100 bytes |
| コンパイル時間 | 3,594 ms |
| コンパイル使用メモリ | 255,112 KB |
| 最終ジャッジ日時 | 2025-02-16 20:16:09 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
long double op(long double a, long double b)
{
return a + b;
}
long double e()
{
return 0;
}
int main()
{
int64_t n, q;
cin >> n >> q;
vector<int64_t> is(q), ss(q), ts(q);
for (int64_t i = 0; i < q; i++)
{
cin >> is[i] >> ss[i] >> ts[i];
is[i]--;
}
vector<int64_t> cnt(100001, 0);
for (int64_t i = 0; i < q; i++)
{
cnt[ss[i]]++;
cnt[ts[i]]--;
}
for (int64_t i = 1; i < cnt.size(); i++)
{
cnt[i] += cnt[i - 1];
}
vector<long double> xs(cnt.size(), 0);
for (int64_t i = 0; i < cnt.size(); i++)
{
xs[i] = (long double)(1) / cnt[i];
}
segtree<long double, op, e> seg(xs);
vector<long double> ans(n, 0);
for (int64_t i = 0; i < q; i++)
{
ans[is[i]] += seg.prod(ss[i], ts[i]);
}
for (auto &&x : ans)
{
cout << fixed << setprecision(20) << x << endl;
}
return 0;
}
ldsyb