結果

問題 No.801 エレベーター
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-18 16:50:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 467 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 86,576 KB
最終ジャッジ日時 2023-09-25 14:26:52
合計ジャッジ時間 9,867 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,576 KB
testcase_01 AC 70 ms
71,440 KB
testcase_02 AC 67 ms
71,528 KB
testcase_03 AC 91 ms
77,200 KB
testcase_04 AC 86 ms
77,368 KB
testcase_05 AC 86 ms
77,264 KB
testcase_06 AC 89 ms
77,528 KB
testcase_07 AC 89 ms
77,232 KB
testcase_08 AC 88 ms
77,192 KB
testcase_09 AC 87 ms
77,244 KB
testcase_10 AC 91 ms
77,444 KB
testcase_11 AC 89 ms
77,292 KB
testcase_12 AC 89 ms
77,432 KB
testcase_13 AC 455 ms
86,144 KB
testcase_14 AC 437 ms
86,352 KB
testcase_15 AC 432 ms
86,472 KB
testcase_16 AC 467 ms
86,308 KB
testcase_17 AC 452 ms
86,208 KB
testcase_18 AC 443 ms
86,560 KB
testcase_19 AC 437 ms
86,496 KB
testcase_20 AC 437 ms
86,384 KB
testcase_21 AC 440 ms
86,192 KB
testcase_22 AC 452 ms
86,576 KB
testcase_23 AC 425 ms
86,364 KB
testcase_24 AC 452 ms
86,464 KB
testcase_25 AC 433 ms
86,392 KB
testcase_26 AC 422 ms
86,456 KB
testcase_27 AC 433 ms
86,416 KB
testcase_28 AC 393 ms
86,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
n, m, k = map(int, input().split())
mod = 10**9+7
t = [tuple(map(int, input().split())) for _ in range(m)]

#dp[x]
#i回目の移動でxにいる場合の数
dp = [0]*(n+1)
dp[1] = 1
for i in range(k):
    tmp = [0]*(n+2)
    dpac = list(accumulate(dp))
    for l, r in t:
        tmp[l] += dpac[r] - dpac[l-1]
        tmp[r+1] -= dpac[r] - dpac[l-1]

    dp = list(map(lambda x: x%mod, accumulate(tmp)))
print(dp[-2])
0