結果

問題 No.801 エレベーター
ユーザー kohei2019kohei2019
提出日時 2022-04-14 00:05:54
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 78,680 KB
最終ジャッジ日時 2023-08-25 16:07:07
合計ジャッジ時間 8,238 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,276 KB
testcase_01 AC 69 ms
71,388 KB
testcase_02 AC 70 ms
71,208 KB
testcase_03 AC 88 ms
76,656 KB
testcase_04 AC 89 ms
76,544 KB
testcase_05 AC 89 ms
76,412 KB
testcase_06 AC 89 ms
76,744 KB
testcase_07 AC 89 ms
76,264 KB
testcase_08 AC 90 ms
76,836 KB
testcase_09 AC 90 ms
76,412 KB
testcase_10 AC 88 ms
76,236 KB
testcase_11 AC 90 ms
76,504 KB
testcase_12 AC 89 ms
76,548 KB
testcase_13 AC 350 ms
77,864 KB
testcase_14 AC 345 ms
78,136 KB
testcase_15 AC 347 ms
78,412 KB
testcase_16 AC 348 ms
78,336 KB
testcase_17 AC 352 ms
78,304 KB
testcase_18 AC 344 ms
78,680 KB
testcase_19 AC 350 ms
78,184 KB
testcase_20 AC 349 ms
78,400 KB
testcase_21 AC 347 ms
78,284 KB
testcase_22 AC 341 ms
78,424 KB
testcase_23 AC 350 ms
78,432 KB
testcase_24 AC 349 ms
78,508 KB
testcase_25 AC 349 ms
78,364 KB
testcase_26 AC 350 ms
78,192 KB
testcase_27 AC 351 ms
78,108 KB
testcase_28 AC 296 ms
78,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# いもす
N,M,K = map(int, input().split())
lsLR = [tuple(map(int,input().split())) for i in range(M)]
mod = 10**9+7
dp = [0]*(N+2)
dp[1] = 1
for i in range(K):
    imos = [0]*(N+2)
    for j in range(1,N+2):
        imos[j] = (imos[j-1]+dp[j])%mod
    dp = [0]*(N+2)
    for j in range(M):
        l,r = lsLR[j]
        cnt = (imos[r]-imos[l-1])%mod
        dp[l] += cnt
        dp[r+1] -= cnt
    for j in range(1,N+2):
        dp[j] = (dp[j-1]+dp[j])%mod
print(dp[-2]%mod)
0