結果

問題 No.2462 七人カノン
ユーザー Today03Today03
提出日時 2023-09-08 21:43:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 966 bytes
コンパイル時間 2,591 ms
コンパイル使用メモリ 208,096 KB
実行使用メモリ 13,204 KB
最終ジャッジ日時 2023-09-08 21:44:02
合計ジャッジ時間 11,817 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,200 KB
testcase_01 AC 6 ms
6,196 KB
testcase_02 AC 4 ms
6,280 KB
testcase_03 AC 10 ms
6,168 KB
testcase_04 AC 10 ms
6,080 KB
testcase_05 AC 9 ms
6,268 KB
testcase_06 AC 10 ms
6,196 KB
testcase_07 AC 10 ms
6,384 KB
testcase_08 AC 10 ms
6,148 KB
testcase_09 AC 10 ms
6,064 KB
testcase_10 AC 10 ms
6,272 KB
testcase_11 AC 10 ms
6,204 KB
testcase_12 AC 10 ms
6,388 KB
testcase_13 AC 160 ms
11,168 KB
testcase_14 AC 168 ms
11,820 KB
testcase_15 AC 154 ms
11,072 KB
testcase_16 AC 186 ms
12,012 KB
testcase_17 AC 202 ms
12,208 KB
testcase_18 AC 60 ms
8,764 KB
testcase_19 AC 61 ms
8,708 KB
testcase_20 AC 161 ms
12,964 KB
testcase_21 AC 191 ms
13,160 KB
testcase_22 AC 163 ms
13,204 KB
testcase_23 AC 163 ms
13,104 KB
testcase_24 AC 120 ms
10,872 KB
testcase_25 AC 177 ms
13,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/segtree>
using namespace atcoder;

double op(double a, double b) {
	return a + b;
}
double e() {
	return 0;
}

const int m = 100000;

int main() {
	int n, q;
	cin >> n >> q;
	vector<int> I(q), S(q), T(q);
	vector<vector<pair<int, int>>> dat(n);
	vector<int> imos(m + 2);
	for (int i = 0; i < q; i++) {
		cin >> I[i] >> S[i] >> T[i];
		I[i]--;
		dat[I[i]].push_back(make_pair(S[i], T[i]));
		imos[S[i]]++;
		imos[T[i]]--;
	}
	for (int i = 0; i <= m; i++) {
		imos[i + 1] += imos[i];
	}
	segtree<double, op, e> st(m + 1);
	for (int i = 0; i <= m; i++) {
		if (imos[i] > 0) {
			st.set(i, 1.0 / imos[i]);
		}
	}
	vector<double> ans(n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < (int)dat[i].size(); j++) {
			int l = dat[i][j].first;
			int r = dat[i][j].second;
			ans[i] += st.prod(l, r);
		}
	}
	cout << fixed << setprecision(15);
	for (int i = 0; i < n; i++) {
		cout << ans[i] << '\n';
	}
}
0