結果

問題 No.801 エレベーター
ユーザー roarisroaris
提出日時 2020-07-24 23:01:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 80,160 KB
最終ジャッジ日時 2023-09-08 05:11:55
合計ジャッジ時間 9,192 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,788 KB
testcase_01 AC 70 ms
70,896 KB
testcase_02 AC 71 ms
71,112 KB
testcase_03 AC 86 ms
76,500 KB
testcase_04 AC 83 ms
76,068 KB
testcase_05 AC 84 ms
76,288 KB
testcase_06 AC 84 ms
76,504 KB
testcase_07 AC 85 ms
76,248 KB
testcase_08 AC 84 ms
76,500 KB
testcase_09 AC 84 ms
76,372 KB
testcase_10 AC 86 ms
76,320 KB
testcase_11 AC 85 ms
76,288 KB
testcase_12 AC 86 ms
76,480 KB
testcase_13 AC 388 ms
79,716 KB
testcase_14 AC 390 ms
79,804 KB
testcase_15 AC 392 ms
79,516 KB
testcase_16 AC 384 ms
79,712 KB
testcase_17 AC 390 ms
80,108 KB
testcase_18 AC 384 ms
79,660 KB
testcase_19 AC 376 ms
80,004 KB
testcase_20 AC 384 ms
79,740 KB
testcase_21 AC 370 ms
79,904 KB
testcase_22 AC 373 ms
79,688 KB
testcase_23 AC 388 ms
79,788 KB
testcase_24 AC 396 ms
80,160 KB
testcase_25 AC 398 ms
80,072 KB
testcase_26 AC 392 ms
79,564 KB
testcase_27 AC 397 ms
79,564 KB
testcase_28 AC 365 ms
80,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

for _ in range(K):
    acc = [0]
    
    for dpi in dp:
        acc.append((acc[-1]+dpi)%MOD)
    
    imos = [0]*(N+1)
    
    for L, R in LR:
        imos[L-1] += acc[R]-acc[L-1]
        imos[R] -= acc[R]-acc[L-1]
    
    for i in range(1, N+1):
        imos[i] += imos[i-1]
        imos[i] %= MOD
    
    dp = imos[:-1]

print(dp[-1])
0