結果

問題 No.2462 七人カノン
ユーザー hato336hato336
提出日時 2023-09-08 22:02:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 629 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 131,616 KB
最終ジャッジ日時 2023-09-08 22:02:16
合計ジャッジ時間 14,364 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
84,940 KB
testcase_01 AC 87 ms
85,644 KB
testcase_02 AC 83 ms
84,984 KB
testcase_03 AC 107 ms
84,804 KB
testcase_04 AC 103 ms
84,788 KB
testcase_05 AC 104 ms
84,372 KB
testcase_06 AC 102 ms
84,244 KB
testcase_07 AC 108 ms
84,376 KB
testcase_08 AC 103 ms
84,660 KB
testcase_09 AC 100 ms
84,200 KB
testcase_10 AC 107 ms
84,540 KB
testcase_11 AC 104 ms
84,508 KB
testcase_12 AC 101 ms
84,380 KB
testcase_13 AC 585 ms
123,868 KB
testcase_14 AC 555 ms
123,900 KB
testcase_15 AC 561 ms
122,312 KB
testcase_16 AC 618 ms
128,784 KB
testcase_17 AC 599 ms
129,144 KB
testcase_18 AC 102 ms
90,148 KB
testcase_19 AC 102 ms
90,372 KB
testcase_20 AC 533 ms
131,212 KB
testcase_21 AC 535 ms
131,616 KB
testcase_22 AC 529 ms
128,960 KB
testcase_23 AC 561 ms
129,196 KB
testcase_24 AC 376 ms
110,268 KB
testcase_25 AC 629 ms
128,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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')
0