結果

問題 No.801 エレベーター
ユーザー tomarint2tomarint2
提出日時 2019-03-17 22:16:58
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 1,087 bytes
コンパイル時間 781 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 78,288 KB
最終ジャッジ日時 2023-09-22 07:18:36
合計ジャッジ時間 10,255 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,576 KB
testcase_01 AC 75 ms
70,992 KB
testcase_02 AC 76 ms
71,264 KB
testcase_03 AC 467 ms
78,136 KB
testcase_04 AC 455 ms
78,148 KB
testcase_05 AC 441 ms
78,156 KB
testcase_06 AC 455 ms
78,288 KB
testcase_07 AC 455 ms
77,904 KB
testcase_08 AC 468 ms
77,828 KB
testcase_09 AC 453 ms
78,132 KB
testcase_10 AC 453 ms
78,112 KB
testcase_11 AC 446 ms
78,020 KB
testcase_12 AC 451 ms
78,024 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 #

mod = 1000000007

def add(a, b):
    return (a + b) % mod

def sub(a, b):
    return (a + mod - b) % mod

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))

def solve():
    N,M,K=map(int,input().split())
    L=[0 for i in range(M)]
    R=[0 for i in range(M)]
    for i in range(M):
        L[i],R[i]=map(int,input().split())
    ans=0

    # n[from][to] : from階からto階へ行く方法
    n=[[0 for j in range(N+1)] for i in range(N+1)]
    for i in range(M):
        for f in range(L[i],R[i]+1):
            for t in range(L[i],R[i]+1):
                n[f][t] += 1

    c=[[0 for i in range(N+1)] for k in range(K+1)]
    c[0][1]=1
    for k in range(1,K+1):
        for t in range(1,N+1):
            for f in range(1,N+1):
                c[k][t] = (c[k][t] + c[k-1][f] * n[f][t]) % mod

    return c[k][N]

print(solve())
0