結果

問題 No.801 エレベーター
ユーザー maspy
提出日時 2020-03-17 15:48:24
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 643 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2024-11-30 22:45:24
合計ジャッジ時間 2,803 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7

# %%
N, M, K = map(int, readline().split())
m = map(int, read().split())
L, R = zip(*zip(m, m))

# %%
dp = [0] * (N + 2)
dp[1] = 1
for _ in range(K):
    newdp = [0] * (N + 2)
    for i in range(1, N + 2):
        dp[i] += dp[i - 1]
    for l, r in zip(L, R):
        x = dp[r] - dp[l - 1]
        newdp[l] += x
        newdp[r + 1] -= x
    for i in range(1, N + 2):
        newdp[i] += newdp[i - 1]
        newdp[i] %= MOD
    dp = newdp

# %%
print(dp[N])
0