結果

問題 No.801 エレベーター
ユーザー NoneNone
提出日時 2021-04-16 22:17:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 489 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 82,632 KB
最終ジャッジ日時 2023-09-16 01:05:24
合計ジャッジ時間 10,648 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,400 KB
testcase_01 AC 74 ms
71,304 KB
testcase_02 AC 72 ms
71,336 KB
testcase_03 AC 90 ms
77,032 KB
testcase_04 AC 90 ms
76,676 KB
testcase_05 AC 89 ms
76,724 KB
testcase_06 AC 90 ms
76,792 KB
testcase_07 AC 92 ms
77,032 KB
testcase_08 AC 91 ms
76,840 KB
testcase_09 AC 91 ms
76,836 KB
testcase_10 AC 89 ms
76,860 KB
testcase_11 AC 90 ms
76,792 KB
testcase_12 AC 90 ms
76,816 KB
testcase_13 AC 453 ms
82,292 KB
testcase_14 AC 460 ms
82,420 KB
testcase_15 AC 449 ms
82,500 KB
testcase_16 AC 464 ms
82,128 KB
testcase_17 AC 462 ms
82,332 KB
testcase_18 AC 460 ms
82,328 KB
testcase_19 AC 482 ms
82,204 KB
testcase_20 AC 473 ms
82,396 KB
testcase_21 AC 469 ms
82,516 KB
testcase_22 AC 464 ms
82,468 KB
testcase_23 AC 469 ms
82,140 KB
testcase_24 AC 481 ms
82,632 KB
testcase_25 AC 489 ms
82,372 KB
testcase_26 AC 476 ms
82,552 KB
testcase_27 AC 469 ms
82,348 KB
testcase_28 AC 459 ms
82,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD=10**9+7
N,M,K=map(int, input().split())
data=[]
for _ in range(M):
    l,r=map(int, input().split())
    l,r=l-1,r-1
    data.append((l,r))

dp=[0]*N
dp[0]=1
for t in range(K):
    acc=[0]
    for a in dp:
        acc.append(acc[-1]+a)

    _imos=[0]*(N+1)
    for l,r in data:
        c=acc[r+1]-acc[l]
        _imos[l]+=c
        _imos[r+1]-=c
        _imos[l]%=MOD
        _imos[r+1]%=MOD

    acc=[0]
    for a in _imos:
        acc.append((acc[-1]+a)%MOD)
    dp=acc[1:-1]

print(dp[-1])
0