結果

問題 No.2709 1975 Powers
ユーザー rin204rin204
提出日時 2024-04-07 14:20:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 970 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 260,072 KB
最終ジャッジ日時 2024-04-07 14:20:26
合計ジャッジ時間 15,440 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 385 ms
248,124 KB
testcase_03 AC 591 ms
246,040 KB
testcase_04 AC 826 ms
257,876 KB
testcase_05 AC 699 ms
259,324 KB
testcase_06 AC 266 ms
198,192 KB
testcase_07 AC 139 ms
122,296 KB
testcase_08 AC 687 ms
257,316 KB
testcase_09 AC 780 ms
257,748 KB
testcase_10 AC 146 ms
126,768 KB
testcase_11 AC 196 ms
160,140 KB
testcase_12 AC 586 ms
245,436 KB
testcase_13 AC 873 ms
258,088 KB
testcase_14 AC 342 ms
254,956 KB
testcase_15 AC 691 ms
257,624 KB
testcase_16 AC 408 ms
257,456 KB
testcase_17 AC 158 ms
135,136 KB
testcase_18 AC 605 ms
254,496 KB
testcase_19 AC 772 ms
260,072 KB
testcase_20 AC 340 ms
245,080 KB
testcase_21 AC 664 ms
257,608 KB
testcase_22 AC 970 ms
257,972 KB
testcase_23 AC 784 ms
258,192 KB
testcase_24 AC 466 ms
256,420 KB
testcase_25 AC 764 ms
258,520 KB
testcase_26 AC 845 ms
258,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p, q = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
C = [10, 9, 7, 5]
dp = [[0] * p for _ in range(5)]
dp[0][0] = 1
for a in A:
    nex = [row[:] for row in dp]
    for t in range(4):
        add = pow(C[t], a, p)
        for j in range(p):
            nex[t + 1][(j + add) % p] += dp[t][j]
    dp = nex

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