結果
問題 |
No.2462 七人カノン
|
ユーザー |
![]() |
提出日時 | 2023-09-08 22:46:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,198 bytes |
コンパイル時間 | 4,340 ms |
コンパイル使用メモリ | 256,012 KB |
最終ジャッジ日時 | 2025-02-16 20:15:29 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 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]; } for (int64_t i = 0; i < 5; i++) { cout << cnt[i] << ' '; } cout << endl; 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; }