結果

問題 No.2462 七人カノン
コンテスト
ユーザー Aeren
提出日時 2023-09-08 21:31:21
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 39 ms / 2,000 ms
+ 638µs
コード長 1,168 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,333 ms
コンパイル使用メモリ 446,732 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2026-07-30 14:06:20
合計ジャッジ時間 8,733 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using namespace numbers;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	cout << fixed << setprecision(15);
	int n, qn;
	cin >> n >> qn;
	vector<array<int, 3>> q(qn);
	const int mx = 1e5;
	vector<int> cnt(mx + 1);
	for(auto &[i, l, r]: q){
		cin >> i >> l >> r, -- i;
		++ cnt[l];
		-- cnt[r];
	}
	vector<double> value(mx + 1);
	for(auto t = 0; t < mx; ++ t){
		cnt[t + 1] += cnt[t];
		value[t + 1] = value[t] + (cnt[t] ? 1.0 / cnt[t] : 0);
	}
	vector<double> res(n);
	for(auto [i, l, r]: q){
		res[i] += value[r] - value[l];
	}
	ranges::copy(res, ostream_iterator<double>(cout, "\n"));
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////
0