結果

問題 No.801 エレベーター
ユーザー tpynerivertpyneriver
提出日時 2019-03-18 00:51:49
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 477 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 86,864 KB
最終ジャッジ日時 2023-09-22 16:18:49
合計ジャッジ時間 10,363 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,416 KB
testcase_01 AC 74 ms
71,636 KB
testcase_02 AC 74 ms
71,320 KB
testcase_03 AC 107 ms
77,544 KB
testcase_04 AC 94 ms
77,328 KB
testcase_05 AC 94 ms
77,416 KB
testcase_06 AC 93 ms
77,404 KB
testcase_07 AC 99 ms
77,308 KB
testcase_08 AC 92 ms
77,436 KB
testcase_09 AC 92 ms
77,380 KB
testcase_10 AC 94 ms
77,408 KB
testcase_11 AC 94 ms
77,456 KB
testcase_12 AC 94 ms
77,288 KB
testcase_13 AC 464 ms
86,180 KB
testcase_14 AC 473 ms
86,528 KB
testcase_15 AC 477 ms
86,208 KB
testcase_16 AC 449 ms
86,180 KB
testcase_17 AC 448 ms
86,556 KB
testcase_18 AC 447 ms
86,572 KB
testcase_19 AC 461 ms
86,456 KB
testcase_20 AC 458 ms
86,520 KB
testcase_21 AC 448 ms
86,208 KB
testcase_22 AC 449 ms
86,864 KB
testcase_23 AC 453 ms
86,652 KB
testcase_24 AC 459 ms
86,272 KB
testcase_25 AC 430 ms
86,376 KB
testcase_26 AC 449 ms
86,424 KB
testcase_27 AC 434 ms
86,504 KB
testcase_28 AC 416 ms
86,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
N, M, K = map(int, input().split())
mod = 10**9 + 7
LR = [tuple(map(int, input().split())) for _ in range(M)]
dp = [0] * (N + 2)
dp[1] = 1
for _ in range(K):
    dp1 = [0] * (N + 2)
    dpac = list(accumulate(dp))
    for l, r in LR:
        dp1[l] += dpac[r] - dpac[l - 1]
        dp1[r + 1] -= dpac[r] - dpac[l - 1]
    dp = list(map(lambda x: x % mod, accumulate(dp1)))
print(dp[-2])
0