結果

問題 No.801 エレベーター
ユーザー UekiUeki
提出日時 2019-03-17 22:07:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 798 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 152,116 KB
最終ジャッジ日時 2023-09-22 06:35:31
合計ジャッジ時間 6,487 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,636 KB
testcase_01 AC 73 ms
71,240 KB
testcase_02 AC 75 ms
71,392 KB
testcase_03 AC 180 ms
76,384 KB
testcase_04 AC 168 ms
76,300 KB
testcase_05 AC 158 ms
76,292 KB
testcase_06 AC 163 ms
76,296 KB
testcase_07 AC 272 ms
77,772 KB
testcase_08 AC 163 ms
76,020 KB
testcase_09 AC 163 ms
76,396 KB
testcase_10 AC 162 ms
76,196 KB
testcase_11 AC 157 ms
76,300 KB
testcase_12 AC 164 ms
76,496 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M, K = map(int, input().split())
elev = [list(map(int, input().split())) for _ in range(M)]

dp = [[0]*(N+2) for _ in range(K+1)]
dp[0][1] = 1

MOD = 10**9+7


def solve():
    for k in range(K):
        for l, r in elev:
            for i in range(l, r+1):
                for j in range(l, r+1):
                    dp[k+1][j] += dp[k][i]
                    dp[k+1][j] %= MOD


def solve2():
    # imos
    for k in range(K):
        for l, r in elev:
            for i in range(l, r+1):
                dp[k+1][l] += dp[k][i]
                dp[k+1][r+1] -= dp[k][i]
        for i in range(N+1):
            dp[k+1][i+1] += dp[k+1][i]
            dp[k+1][i] %= MOD


solve2()
print(dp[K][N])
0