結果

問題 No.801 エレベーター
ユーザー tpynerivertpyneriver
提出日時 2019-03-18 22:01:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 500 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 1,199 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 86,624 KB
最終ジャッジ日時 2023-09-26 10:49:33
合計ジャッジ時間 11,439 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,376 KB
testcase_01 AC 66 ms
71,396 KB
testcase_02 AC 68 ms
71,348 KB
testcase_03 AC 90 ms
77,060 KB
testcase_04 AC 89 ms
77,172 KB
testcase_05 AC 91 ms
77,224 KB
testcase_06 AC 88 ms
77,220 KB
testcase_07 AC 89 ms
77,376 KB
testcase_08 AC 89 ms
77,372 KB
testcase_09 AC 88 ms
77,152 KB
testcase_10 AC 89 ms
77,376 KB
testcase_11 AC 88 ms
77,468 KB
testcase_12 AC 90 ms
77,324 KB
testcase_13 AC 500 ms
86,608 KB
testcase_14 AC 477 ms
86,396 KB
testcase_15 AC 492 ms
86,448 KB
testcase_16 AC 482 ms
86,576 KB
testcase_17 AC 490 ms
86,376 KB
testcase_18 AC 479 ms
86,356 KB
testcase_19 AC 471 ms
86,624 KB
testcase_20 AC 499 ms
86,352 KB
testcase_21 AC 482 ms
86,336 KB
testcase_22 AC 488 ms
86,368 KB
testcase_23 AC 488 ms
86,280 KB
testcase_24 AC 454 ms
86,456 KB
testcase_25 AC 464 ms
86,516 KB
testcase_26 AC 455 ms
86,368 KB
testcase_27 AC 480 ms
86,384 KB
testcase_28 AC 438 ms
86,372 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 = [x%mod for x in accumulate(dp1)]   
    #dp = list(map(lambda x: x % mod, accumulate(dp1)))
print(dp[-2])
0