結果

問題 No.801 エレベーター
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-09 21:52:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,043 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,008 KB
実行使用メモリ 42,312 KB
最終ジャッジ日時 2023-10-19 08:17:27
合計ジャッジ時間 24,222 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 478 ms
42,312 KB
testcase_01 AC 479 ms
42,312 KB
testcase_02 AC 479 ms
42,312 KB
testcase_03 AC 492 ms
42,312 KB
testcase_04 AC 499 ms
42,312 KB
testcase_05 AC 487 ms
42,312 KB
testcase_06 AC 497 ms
42,312 KB
testcase_07 AC 501 ms
42,312 KB
testcase_08 AC 489 ms
42,312 KB
testcase_09 AC 486 ms
42,312 KB
testcase_10 AC 490 ms
42,312 KB
testcase_11 AC 493 ms
42,312 KB
testcase_12 AC 491 ms
42,312 KB
testcase_13 AC 926 ms
42,312 KB
testcase_14 AC 928 ms
42,312 KB
testcase_15 AC 924 ms
42,312 KB
testcase_16 AC 1,043 ms
42,312 KB
testcase_17 AC 921 ms
42,312 KB
testcase_18 AC 924 ms
42,312 KB
testcase_19 AC 934 ms
42,312 KB
testcase_20 AC 929 ms
42,312 KB
testcase_21 AC 927 ms
42,312 KB
testcase_22 AC 926 ms
42,312 KB
testcase_23 AC 923 ms
42,312 KB
testcase_24 AC 930 ms
42,312 KB
testcase_25 AC 947 ms
42,312 KB
testcase_26 AC 925 ms
42,312 KB
testcase_27 AC 924 ms
42,312 KB
testcase_28 AC 933 ms
42,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10**9+7

n, m, k = map(int, input().split())
L, R = np.array([input().split() for _ in range(m)], dtype=np.int64).T

dp = np.ones(n+2, dtype=np.int64)
dp[0] = 0

for _ in range(k):
    newDP = np.zeros_like(dp)
    cnt = dp[R] - dp[L - 1]
    np.add.at(newDP, L, cnt)
    np.add.at(newDP, R + 1, -cnt)
    dp = np.cumsum(newDP) % mod
    dp = np.cumsum(dp) % mod


print((dp[n] - dp[n - 1]) % mod)
0