結果

問題 No.801 エレベーター
ユーザー H3PO4H3PO4
提出日時 2021-02-09 09:41:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 78,912 KB
最終ジャッジ日時 2023-09-20 20:03:26
合計ジャッジ時間 8,282 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,296 KB
testcase_01 AC 72 ms
71,104 KB
testcase_02 AC 70 ms
71,252 KB
testcase_03 AC 88 ms
76,696 KB
testcase_04 AC 92 ms
76,640 KB
testcase_05 AC 88 ms
76,740 KB
testcase_06 AC 88 ms
76,568 KB
testcase_07 AC 86 ms
76,660 KB
testcase_08 AC 88 ms
76,660 KB
testcase_09 AC 88 ms
76,596 KB
testcase_10 AC 89 ms
76,812 KB
testcase_11 AC 88 ms
76,596 KB
testcase_12 AC 89 ms
76,756 KB
testcase_13 AC 337 ms
78,848 KB
testcase_14 AC 336 ms
78,652 KB
testcase_15 AC 336 ms
78,720 KB
testcase_16 AC 333 ms
78,508 KB
testcase_17 AC 335 ms
78,796 KB
testcase_18 AC 339 ms
78,752 KB
testcase_19 AC 333 ms
78,824 KB
testcase_20 AC 333 ms
78,664 KB
testcase_21 AC 333 ms
78,504 KB
testcase_22 AC 336 ms
78,912 KB
testcase_23 AC 335 ms
78,792 KB
testcase_24 AC 329 ms
78,680 KB
testcase_25 AC 332 ms
78,664 KB
testcase_26 AC 333 ms
78,660 KB
testcase_27 AC 336 ms
78,700 KB
testcase_28 AC 297 ms
78,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = map(int, input().split())
elv = [tuple(map(int, input().split())) for _ in range(M)]
MOD = 10 ** 9 + 7

dp = [0] * (N + 2)
dp[1] = 1


def accumulate_mod(X):
    res = [0] * len(X)
    res[0] = X[0]
    for i in range(1, len(X)):
        res[i] = (res[i - 1] + X[i]) % MOD
    return res


for _ in range(K):
    acc = accumulate_mod(dp)
    imos = [0] * (N + 2)
    for l, r in elv:
        s = acc[r] - acc[l - 1]
        imos[l] += s
        imos[r + 1] -= s
    dp = accumulate_mod(imos)
print(dp[N])
0