結果

問題 No.2462 七人カノン
コンテスト
ユーザー detteiuu
提出日時 2024-12-22 03:26:19
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 493 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 285 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 104,064 KB
最終ジャッジ日時 2026-05-28 12:59:02
合計ジャッジ時間 8,115 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, Q = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(Q)]

imos = [0]*(10**5+1)
for I, S, T in query:
    imos[S] += 1
    imos[T] -= 1
for i in range(1, 10**5+1):
    imos[i] += imos[i-1]

for i in range(10**5+1):
    if 1 <= imos[i]:
        imos[i] = 1/imos[i]

cum = [0]
for i in range(10**5+1):
    cum.append(cum[-1]+imos[i])

def cumQ(L, R):
    return cum[R]-cum[L]

ans = [0]*N
for I, S, T in query:
    ans[I-1] += cumQ(S, T)

print(*ans, sep="\n")
0