結果

問題 No.801 エレベーター
ユーザー maspymaspy
提出日時 2020-03-17 15:44:34
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 649 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 30,416 KB
最終ジャッジ日時 2023-08-20 18:48:38
合計ジャッジ時間 41,388 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
29,716 KB
testcase_01 AC 133 ms
29,704 KB
testcase_02 AC 134 ms
29,728 KB
testcase_03 AC 166 ms
29,668 KB
testcase_04 AC 163 ms
29,740 KB
testcase_05 AC 163 ms
29,724 KB
testcase_06 AC 162 ms
29,728 KB
testcase_07 AC 164 ms
29,684 KB
testcase_08 AC 170 ms
29,664 KB
testcase_09 AC 167 ms
29,656 KB
testcase_10 AC 167 ms
29,720 KB
testcase_11 AC 166 ms
29,672 KB
testcase_12 AC 169 ms
29,752 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 #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7

# %%
N, M, K = map(int, readline().split())
LR = np.array(read().split(), np.int32)
L = LR[::2]
R = LR[1::2]
L.flags.writeable = False
R.flags.writeable = False

# %%
dp = np.zeros(N + 2, np.int64)
dp[1] = 1
for _ in range(K):
    newdp = np.zeros_like(dp)
    np.cumsum(dp, out=dp)
    dp %= MOD
    x = dp[R] - dp[L - 1]
    np.add.at(newdp, L, x)
    np.add.at(newdp, R + 1, -x)
    np.cumsum(newdp, out=newdp)
    newdp %= MOD
    dp = newdp

# %%
print(dp[N])
0