結果

問題 No.2709 1975 Powers
ユーザー Basin-BugBasin-Bug
提出日時 2024-03-31 14:09:20
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 676 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 773,268 KB
最終ジャッジ日時 2024-03-31 14:09:59
合計ジャッジ時間 30,000 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 679 ms
274,760 KB
testcase_03 AC 1,080 ms
411,896 KB
testcase_04 MLE -
testcase_05 MLE -
testcase_06 WA -
testcase_07 AC 232 ms
129,188 KB
testcase_08 WA -
testcase_09 MLE -
testcase_10 AC 250 ms
133,688 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 MLE -
testcase_14 AC 618 ms
255,004 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 MLE -
testcase_20 WA -
testcase_21 WA -
testcase_22 TLE -
testcase_23 MLE -
testcase_24 WA -
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P, Q = map(int, input().split())
A = list(map(int, input().split()))

dp = [[[0] * P for i in range(5)] for j in range(N + 1)]
dp[0][0][0] = 1

for i in range(1, N + 1):
  a = pow(10, A[i - 1], P)
  b = pow(9, A[i - 1], P)
  c = pow(7, A[i - 1], P)
  d = pow(5, A[i - 1], P)

  for j in range(P):
    dp[i][0][j] += dp[i - 1][0][j]
    dp[i][1][(j + a) % P] += dp[i - 1][0][j]
    dp[i][1][j] += dp[i - 1][1][j]
    dp[i][2][(j + b) % P] += dp[i - 1][1][j]
    dp[i][2][j] += dp[i - 1][2][j]
    dp[i][3][(j + c) % P] += dp[i - 1][2][j]
    dp[i][3][j] += dp[i - 1][3][j]
    dp[i][4][(j + d) % P] += dp[i - 1][3][j]
    dp[i][4][j] += dp[i - 1][4][j]

print(dp[-1][-1][Q])
0