結果

問題 No.2462 七人カノン
ユーザー lloyzlloyz
提出日時 2023-09-09 18:27:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 93,808 KB
最終ジャッジ日時 2023-09-09 18:27:43
合計ジャッジ時間 12,366 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
78,772 KB
testcase_01 AC 86 ms
78,704 KB
testcase_02 AC 84 ms
78,660 KB
testcase_03 AC 103 ms
79,264 KB
testcase_04 AC 95 ms
78,896 KB
testcase_05 AC 98 ms
79,048 KB
testcase_06 AC 99 ms
79,164 KB
testcase_07 AC 95 ms
78,996 KB
testcase_08 AC 97 ms
79,168 KB
testcase_09 AC 95 ms
78,908 KB
testcase_10 AC 100 ms
78,984 KB
testcase_11 AC 100 ms
78,856 KB
testcase_12 AC 97 ms
78,848 KB
testcase_13 AC 340 ms
89,844 KB
testcase_14 AC 337 ms
90,048 KB
testcase_15 AC 326 ms
89,752 KB
testcase_16 AC 345 ms
90,520 KB
testcase_17 AC 374 ms
90,372 KB
testcase_18 AC 115 ms
82,736 KB
testcase_19 AC 116 ms
82,612 KB
testcase_20 AC 380 ms
93,808 KB
testcase_21 AC 372 ms
93,404 KB
testcase_22 AC 363 ms
92,744 KB
testcase_23 AC 371 ms
93,028 KB
testcase_24 AC 331 ms
88,804 KB
testcase_25 AC 382 ms
92,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())

DP = [0 for _ in range(10**5 + 1)]
P = [[] for _ in range(10**5 + 1)]
for _ in range(q):
    i, s, t = map(int, input().split())
    i -= 1
    DP[s] += 1
    DP[t] -= 1
    P[i].append((s, t))

for t in range(10**5):
    DP[t + 1] += DP[t]
for t in range(10**5 + 1):
    if DP[t] > 0:
        DP[t] = 1 / DP[t]
for t in range(10**5):
    DP[t + 1] += DP[t]
for i in range(n):
    res = 0
    for s, t in P[i]:
        res += DP[t - 1]
        if s > 0:
            res -= DP[s - 1]
    print(res)
0