結果

問題 No.2462 七人カノン
ユーザー hiro1729hiro1729
提出日時 2023-09-09 07:37:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 93,108 KB
最終ジャッジ日時 2023-09-09 07:37:44
合計ジャッジ時間 13,684 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
77,640 KB
testcase_01 AC 83 ms
77,512 KB
testcase_02 AC 80 ms
77,800 KB
testcase_03 AC 103 ms
78,028 KB
testcase_04 AC 94 ms
77,904 KB
testcase_05 AC 96 ms
77,980 KB
testcase_06 AC 93 ms
77,688 KB
testcase_07 AC 111 ms
77,936 KB
testcase_08 AC 91 ms
77,704 KB
testcase_09 AC 91 ms
77,932 KB
testcase_10 AC 97 ms
77,888 KB
testcase_11 AC 94 ms
77,936 KB
testcase_12 AC 94 ms
78,180 KB
testcase_13 AC 324 ms
88,988 KB
testcase_14 AC 331 ms
89,940 KB
testcase_15 AC 305 ms
89,052 KB
testcase_16 AC 330 ms
90,436 KB
testcase_17 AC 355 ms
90,108 KB
testcase_18 AC 110 ms
82,360 KB
testcase_19 AC 111 ms
82,572 KB
testcase_20 AC 364 ms
93,108 KB
testcase_21 AC 367 ms
92,912 KB
testcase_22 AC 360 ms
92,520 KB
testcase_23 AC 403 ms
92,804 KB
testcase_24 AC 255 ms
88,260 KB
testcase_25 AC 372 ms
92,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
a = [0] * 100001
p = [[] for _ in range(n)]
for _ in range(q):
	i, s, t = map(int, input().split())
	a[s] += 1
	a[t] -= 1
	p[i - 1].append((s, t))
for t in range(100000):
	a[t + 1] += a[t]
for t in range(100001):
	if a[t]:
		a[t] = 1 / a[t]
for t in range(100000):
	a[t + 1] += a[t]
for i in p:
	ans = 0
	for s, t in i:
		ans += a[t - 1]
		if s:
			ans -= a[s - 1]
	print(ans)
0