結果

問題 No.801 エレベーター
ユーザー H3PO4H3PO4
提出日時 2021-02-09 09:49:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 489 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 30,508 KB
最終ジャッジ日時 2023-09-20 20:14:29
合計ジャッジ時間 38,544 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
29,716 KB
testcase_01 AC 123 ms
29,660 KB
testcase_02 AC 124 ms
29,624 KB
testcase_03 AC 153 ms
29,728 KB
testcase_04 AC 153 ms
29,732 KB
testcase_05 AC 152 ms
29,720 KB
testcase_06 AC 152 ms
29,756 KB
testcase_07 AC 157 ms
29,736 KB
testcase_08 AC 157 ms
29,748 KB
testcase_09 AC 151 ms
29,708 KB
testcase_10 AC 153 ms
29,720 KB
testcase_11 AC 152 ms
29,764 KB
testcase_12 AC 154 ms
29,700 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np

input = sys.stdin.buffer.readline

N, M, K = map(int, input().split())
elv = np.array([tuple(map(int, input().split())) for _ in range(M)])
MOD = 10 ** 9 + 7

dp = np.zeros(N + 2, dtype=np.int64)
dp[1] = 1

for _ in range(K):
    acc = np.cumsum(dp)
    imos = np.zeros(N + 2, dtype=np.int64)
    S = acc[elv[:, 1]] - acc[elv[:, 0] - 1]
    np.add.at(imos, elv[:, 0], S)
    np.subtract.at(imos, elv[:, 1] + 1, S)
    dp = np.cumsum(imos) % MOD
print(dp[N])
0