結果

問題 No.801 エレベーター
ユーザー kamojirokamojiro
提出日時 2019-03-17 22:53:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 476 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 166,736 KB
最終ジャッジ日時 2023-09-22 09:11:31
合計ジャッジ時間 5,111 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
12,580 KB
testcase_01 AC 16 ms
8,320 KB
testcase_02 AC 16 ms
8,184 KB
testcase_03 AC 110 ms
11,692 KB
testcase_04 AC 118 ms
11,672 KB
testcase_05 AC 115 ms
11,656 KB
testcase_06 AC 111 ms
11,648 KB
testcase_07 AC 115 ms
11,744 KB
testcase_08 AC 111 ms
11,616 KB
testcase_09 AC 108 ms
11,748 KB
testcase_10 AC 113 ms
11,796 KB
testcase_11 AC 106 ms
11,676 KB
testcase_12 AC 110 ms
11,648 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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