結果

問題 No.2709 1975 Powers
ユーザー 👑 H20H20
提出日時 2024-04-06 16:29:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 785 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 85,088 KB
最終ジャッジ日時 2024-04-06 16:29:45
合計ジャッジ時間 10,899 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 40 ms
53,332 KB
testcase_02 AC 68 ms
64,460 KB
testcase_03 AC 448 ms
66,516 KB
testcase_04 AC 623 ms
71,440 KB
testcase_05 AC 515 ms
72,048 KB
testcase_06 AC 238 ms
71,892 KB
testcase_07 AC 41 ms
55,484 KB
testcase_08 AC 246 ms
81,396 KB
testcase_09 AC 511 ms
75,216 KB
testcase_10 AC 41 ms
55,484 KB
testcase_11 AC 110 ms
68,972 KB
testcase_12 AC 132 ms
76,588 KB
testcase_13 AC 537 ms
85,088 KB
testcase_14 AC 151 ms
67,788 KB
testcase_15 AC 175 ms
69,976 KB
testcase_16 AC 449 ms
72,704 KB
testcase_17 AC 56 ms
64,428 KB
testcase_18 AC 147 ms
79,876 KB
testcase_19 AC 703 ms
80,772 KB
testcase_20 AC 74 ms
68,148 KB
testcase_21 AC 242 ms
81,392 KB
testcase_22 AC 722 ms
68,180 KB
testcase_23 AC 785 ms
82,864 KB
testcase_24 AC 752 ms
75,912 KB
testcase_25 AC 718 ms
69,956 KB
testcase_26 AC 740 ms
68,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,P,Q = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
D = collections.defaultdict(int)
for c in reversed(range(N)):
    cc = pow(7,A[c],P)
    for b in range(c):
        bb = pow(9,A[b],P)
        for a in range(b):
            ans += D[(Q-cc-bb-pow(10,A[a],P))%P]
    D[pow(5,A[c],P)]+=1
print(ans)
0