結果

問題 No.801 エレベーター
ユーザー anagohirameanagohirame
提出日時 2019-03-18 13:38:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 561 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 1,734 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 149,572 KB
最終ジャッジ日時 2023-09-25 09:34:58
合計ジャッジ時間 11,450 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,088 KB
testcase_01 AC 71 ms
70,984 KB
testcase_02 AC 71 ms
70,928 KB
testcase_03 AC 90 ms
76,312 KB
testcase_04 AC 91 ms
76,688 KB
testcase_05 AC 92 ms
76,456 KB
testcase_06 AC 93 ms
76,172 KB
testcase_07 AC 95 ms
76,180 KB
testcase_08 AC 96 ms
76,352 KB
testcase_09 AC 97 ms
76,492 KB
testcase_10 AC 96 ms
76,492 KB
testcase_11 AC 92 ms
76,432 KB
testcase_12 AC 92 ms
76,416 KB
testcase_13 AC 545 ms
149,164 KB
testcase_14 AC 543 ms
149,404 KB
testcase_15 AC 561 ms
149,156 KB
testcase_16 AC 543 ms
149,336 KB
testcase_17 AC 548 ms
148,836 KB
testcase_18 AC 544 ms
148,712 KB
testcase_19 AC 541 ms
149,016 KB
testcase_20 AC 541 ms
149,296 KB
testcase_21 AC 540 ms
149,132 KB
testcase_22 AC 538 ms
149,096 KB
testcase_23 AC 516 ms
148,780 KB
testcase_24 AC 517 ms
148,768 KB
testcase_25 AC 513 ms
148,764 KB
testcase_26 AC 519 ms
149,508 KB
testcase_27 AC 514 ms
148,968 KB
testcase_28 AC 512 ms
149,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input():
 	return sys.stdin.readline()[:-1]

MOD = 10**9 + 7
n, m, k = map(int, input().split())
ele = []
for _ in range(m):
	l, r = map(int, input().split())
	ele.append([l-1, r-1])

dp = [[0 for _ in range(n+1)] for _ in range(k+1)]
dp[0][0] = 1

for i in range(k):
	tmp = [0]
	for j in range(n):
		tmp.append(tmp[-1] + dp[i][j])
	#print(tmp)
	def get(l, r):
		return tmp[r+1] - tmp[l]
	for j in range(m):
		l, r = ele[j][0], ele[j][1]
		dp[i+1][l] += get(l, r)
		dp[i+1][r+1] -= get(l, r)

	for j in range(1, n+1):
		dp[i+1][j] += dp[i+1][j-1]
		dp[i+1][j] %= MOD

	dp[i+1][0] %= MOD

#print(dp)
print(dp[k][n-1])
0