結果
問題 | No.2709 1975 Powers |
ユーザー | Basin-Bug |
提出日時 | 2024-03-31 14:47:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,179 ms / 2,000 ms |
コード長 | 840 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 78,184 KB |
最終ジャッジ日時 | 2024-04-06 00:58:36 |
合計ジャッジ時間 | 15,897 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 35 ms
53,460 KB |
testcase_02 | AC | 377 ms
73,968 KB |
testcase_03 | AC | 534 ms
71,000 KB |
testcase_04 | AC | 887 ms
73,080 KB |
testcase_05 | AC | 721 ms
72,324 KB |
testcase_06 | AC | 244 ms
69,160 KB |
testcase_07 | AC | 141 ms
73,104 KB |
testcase_08 | AC | 671 ms
73,848 KB |
testcase_09 | AC | 775 ms
72,880 KB |
testcase_10 | AC | 151 ms
73,224 KB |
testcase_11 | AC | 182 ms
69,672 KB |
testcase_12 | AC | 546 ms
74,648 KB |
testcase_13 | AC | 936 ms
74,156 KB |
testcase_14 | AC | 300 ms
70,468 KB |
testcase_15 | AC | 645 ms
74,488 KB |
testcase_16 | AC | 396 ms
70,148 KB |
testcase_17 | AC | 157 ms
70,584 KB |
testcase_18 | AC | 570 ms
74,488 KB |
testcase_19 | AC | 781 ms
72,440 KB |
testcase_20 | AC | 322 ms
74,288 KB |
testcase_21 | AC | 665 ms
73,848 KB |
testcase_22 | AC | 1,179 ms
78,184 KB |
testcase_23 | AC | 826 ms
72,520 KB |
testcase_24 | AC | 464 ms
70,120 KB |
testcase_25 | AC | 803 ms
72,280 KB |
testcase_26 | AC | 912 ms
72,960 KB |
ソースコード
N, P, Q = map(int, input().split()) A = list(map(int, input().split())) A.sort() current = [[0] * P for i in range(5)] previous = [[0] * P for i in range(5)] previous[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(5): for k in range(P): current[j][k] = 0 for j in range(P): current[0][j] += previous[0][j] current[1][j] += previous[1][j] current[2][j] += previous[2][j] current[3][j] += previous[3][j] current[4][j] += previous[4][j] current[1][(j + a) % P] += previous[0][j] current[2][(j + b) % P] += previous[1][j] current[3][(j + c) % P] += previous[2][j] current[4][(j + d) % P] += previous[3][j] previous, current = current, previous print(previous[4][Q])