結果

問題 No.801 エレベーター
ユーザー tomarint2tomarint2
提出日時 2019-03-17 22:10:31
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,085 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 78,552 KB
最終ジャッジ日時 2023-09-22 06:56:53
合計ジャッジ時間 11,517 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,336 KB
testcase_01 AC 71 ms
71,272 KB
testcase_02 AC 71 ms
71,272 KB
testcase_03 AC 622 ms
78,356 KB
testcase_04 AC 606 ms
78,544 KB
testcase_05 AC 584 ms
78,364 KB
testcase_06 AC 612 ms
78,552 KB
testcase_07 AC 623 ms
78,364 KB
testcase_08 AC 630 ms
78,372 KB
testcase_09 AC 605 ms
78,464 KB
testcase_10 AC 604 ms
78,392 KB
testcase_11 AC 623 ms
78,312 KB
testcase_12 AC 600 ms
78,332 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] = add(c[k][t],mul(c[k-1][f],n[f][t]))

    return c[k][N]

print(solve())
0