結果

問題 No.801 エレベーター
ユーザー taki_gtaki_g
提出日時 2019-03-18 17:14:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 542 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 86,596 KB
実行使用メモリ 150,704 KB
最終ジャッジ日時 2023-09-25 15:04:01
合計ジャッジ時間 12,369 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
133,908 KB
testcase_01 AC 155 ms
134,052 KB
testcase_02 AC 158 ms
133,980 KB
testcase_03 AC 172 ms
134,476 KB
testcase_04 AC 174 ms
134,460 KB
testcase_05 AC 173 ms
134,484 KB
testcase_06 AC 176 ms
134,552 KB
testcase_07 AC 172 ms
134,548 KB
testcase_08 AC 172 ms
134,556 KB
testcase_09 AC 175 ms
134,596 KB
testcase_10 AC 173 ms
134,572 KB
testcase_11 AC 174 ms
134,536 KB
testcase_12 AC 172 ms
134,548 KB
testcase_13 AC 530 ms
150,512 KB
testcase_14 AC 532 ms
150,396 KB
testcase_15 AC 527 ms
150,468 KB
testcase_16 AC 542 ms
150,428 KB
testcase_17 AC 534 ms
150,556 KB
testcase_18 AC 529 ms
150,472 KB
testcase_19 AC 535 ms
150,476 KB
testcase_20 AC 534 ms
150,544 KB
testcase_21 AC 538 ms
150,544 KB
testcase_22 AC 533 ms
150,336 KB
testcase_23 AC 502 ms
150,704 KB
testcase_24 AC 513 ms
150,460 KB
testcase_25 AC 508 ms
150,516 KB
testcase_26 AC 512 ms
150,568 KB
testcase_27 AC 505 ms
150,456 KB
testcase_28 AC 504 ms
150,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
dp=[[0 for i in range(3030)]for j in range(3030)]
e=[]
for i in range(m) :
    x,y=map(int,input().split())
    e.append([x,y])
mod = 1000000007
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]%=mod
    for p in e :
        dp[i+1][p[0]]+=dp[i][p[1]]-dp[i][p[0]-1]
        dp[i+1][p[1]+1]-=dp[i][p[1]]-dp[i][p[0]-1]
    for j in range(n):
        dp[i+1][j+1]+=dp[i+1][j]
        dp[i+1][j+1]%=mod
print(dp[k][n])
0