結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-08 23:07:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,507 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,892 KB
実行使用メモリ 42,644 KB
最終ジャッジ日時 2023-10-19 01:08:38
合計ジャッジ時間 22,260 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 502 ms
42,644 KB
testcase_01 AC 505 ms
42,644 KB
testcase_02 AC 506 ms
42,644 KB
testcase_03 AC 519 ms
42,644 KB
testcase_04 AC 505 ms
42,644 KB
testcase_05 AC 511 ms
42,644 KB
testcase_06 AC 502 ms
42,644 KB
testcase_07 AC 507 ms
42,644 KB
testcase_08 AC 865 ms
42,644 KB
testcase_09 AC 502 ms
42,644 KB
testcase_10 AC 1,436 ms
42,644 KB
testcase_11 AC 721 ms
42,644 KB
testcase_12 AC 669 ms
42,644 KB
testcase_13 AC 714 ms
42,644 KB
testcase_14 AC 728 ms
42,644 KB
testcase_15 AC 1,143 ms
42,644 KB
testcase_16 AC 606 ms
42,644 KB
testcase_17 AC 607 ms
42,644 KB
testcase_18 AC 1,069 ms
42,644 KB
testcase_19 AC 703 ms
42,644 KB
testcase_20 AC 510 ms
42,644 KB
testcase_21 AC 943 ms
42,644 KB
testcase_22 AC 499 ms
42,644 KB
testcase_23 AC 501 ms
42,644 KB
testcase_24 AC 507 ms
42,644 KB
testcase_25 AC 1,473 ms
42,644 KB
testcase_26 AC 1,507 ms
42,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
mod = 998244353
N, Q = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)

dp = np.zeros(N + 1, dtype=np.int64)
dp[0] = 1
for a in A:
    prev = np.copy(dp)
    dp *= a - 1
    dp %= mod
    dp[1:] += prev[:-1]
    dp %= mod

ans = dp[B]
print(*ans, sep="\n")
0