結果
問題 |
No.2462 七人カノン
|
ユーザー |
|
提出日時 | 2023-09-08 22:02:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 577 ms / 2,000 ms |
コード長 | 696 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 82,100 KB |
実行使用メモリ | 131,392 KB |
最終ジャッジ日時 | 2024-06-26 15:02:07 |
合計ジャッジ時間 | 12,600 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
n,q = map(int,input().split()) event = [] x = [] for i in range(q): e,s,t = map(int,input().split()) event.append((e,s,1)) event.append((e,t,-1)) x.append((e,s,t)) table = [0 for i in range(100000+1)] temp = 0 event.sort(lambda x:x[1]) i = 0 for e,s,f in event: if f == 1: while i != s: table[i] = 1/temp if temp != 0 else 0 i += 1 temp += 1 else: while i != s: table[i] = 1/temp if temp != 0 else 0 i += 1 temp -= 1 import itertools ta = list(itertools.accumulate(table)) ta.append(0) ans = [0 for i in range(n)] for e,s,t in x: e -= 1 ans[e] += ta[t-1]-ta[s-1] print(*ans,sep='\n')