結果

問題 No.801 エレベーター
ユーザー 双六双六
提出日時 2020-08-11 03:35:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 846 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 147,936 KB
最終ジャッジ日時 2024-04-17 16:46:49
合計ジャッジ時間 8,463 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
60,160 KB
testcase_01 AC 45 ms
60,160 KB
testcase_02 AC 50 ms
60,160 KB
testcase_03 AC 62 ms
68,864 KB
testcase_04 AC 60 ms
68,736 KB
testcase_05 AC 60 ms
68,352 KB
testcase_06 AC 61 ms
68,736 KB
testcase_07 AC 62 ms
68,992 KB
testcase_08 AC 62 ms
68,864 KB
testcase_09 AC 61 ms
68,992 KB
testcase_10 AC 62 ms
68,352 KB
testcase_11 AC 61 ms
68,480 KB
testcase_12 AC 62 ms
68,352 KB
testcase_13 AC 411 ms
147,584 KB
testcase_14 AC 408 ms
147,936 KB
testcase_15 AC 407 ms
147,712 KB
testcase_16 AC 408 ms
147,584 KB
testcase_17 AC 401 ms
147,508 KB
testcase_18 AC 403 ms
147,456 KB
testcase_19 AC 396 ms
147,628 KB
testcase_20 AC 398 ms
147,712 KB
testcase_21 AC 398 ms
147,712 KB
testcase_22 AC 405 ms
147,584 KB
testcase_23 AC 406 ms
147,456 KB
testcase_24 AC 406 ms
147,456 KB
testcase_25 AC 405 ms
147,712 KB
testcase_26 AC 402 ms
147,832 KB
testcase_27 AC 401 ms
147,764 KB
testcase_28 AC 395 ms
147,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
import copy

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M, K = getlist()
	ele = []
	for i in range(M):
		L, R = getlist()
		L -= 1; R -= 1
		ele.append([L, R])
	
	DP = [[0] * (N + 1) for i in range(K + 1)]
	DP[0][1] = 1
	for i in range(K):
		# 累積和
		for j in range(N):
			DP[i][j + 1] += DP[i][j]
			DP[i][j + 1] %= con

		imos = [0] * (N + 1)
		for j in range(M):
			l, r = ele[j]
			val = DP[i][r + 1] - DP[i][l]
			imos[l] += val; imos[r + 1] -= val

		for j in range(N):
			imos[j + 1] += imos[j]
			imos[j + 1] %= con

		for j in range(N):
			DP[i + 1][j + 1] = imos[j]

	ans = DP[-1][-1]
	print(ans % con)


if __name__ == '__main__':
	main()
0