結果

問題 No.801 エレベーター
ユーザー Navier_Boltzmann
提出日時 2023-06-24 13:19:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 635 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,504 KB
実行使用メモリ 226,044 KB
最終ジャッジ日時 2024-07-01 16:03:04
合計ジャッジ時間 11,862 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N,M,K = map(int,input().split())
mod = 10**9 + 7


LR = [tuple(map(int,input().split())) for _ in range(M)]

dp = [[0]*(N+1) for _ in range(K+1)]
dp[0][1] = 1
for i in range(K):
    
    I = [0]*(N+2)
    S = list(accumulate([0]+dp[i]))
    for l,r in LR:
        
        ds = S[r+1]-S[l]
        I[l] += ds
        I[r+1] -= ds
    
    I = list(accumulate(I))
    dp[i+1] = [i%mod for i in I[:N+1]]

print(dp[-1][N])


0