結果
| 問題 |
No.801 エレベーター
|
| コンテスト | |
| ユーザー |
hogeandfuga
|
| 提出日時 | 2019-03-18 16:50:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 475 ms / 2,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 85,596 KB |
| 最終ジャッジ日時 | 2024-07-18 11:21:19 |
| 合計ジャッジ時間 | 9,222 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
from itertools import accumulate
n, m, k = map(int, input().split())
mod = 10**9+7
t = [tuple(map(int, input().split())) for _ in range(m)]
#dp[x]
#i回目の移動でxにいる場合の数
dp = [0]*(n+1)
dp[1] = 1
for i in range(k):
tmp = [0]*(n+2)
dpac = list(accumulate(dp))
for l, r in t:
tmp[l] += dpac[r] - dpac[l-1]
tmp[r+1] -= dpac[r] - dpac[l-1]
dp = list(map(lambda x: x%mod, accumulate(tmp)))
print(dp[-2])
hogeandfuga