結果

問題 No.2709 1975 Powers
ユーザー 👑 H20H20
提出日時 2024-04-06 16:27:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,961 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 85,116 KB
最終ジャッジ日時 2024-04-06 16:27:25
合計ジャッジ時間 24,055 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 95 ms
64,472 KB
testcase_03 AC 1,140 ms
66,536 KB
testcase_04 AC 1,714 ms
71,460 KB
testcase_05 AC 1,278 ms
72,080 KB
testcase_06 AC 545 ms
74,060 KB
testcase_07 AC 42 ms
55,484 KB
testcase_08 AC 570 ms
83,404 KB
testcase_09 AC 1,295 ms
77,320 KB
testcase_10 AC 43 ms
55,484 KB
testcase_11 AC 138 ms
71,156 KB
testcase_12 AC 240 ms
78,668 KB
testcase_13 AC 1,364 ms
85,116 KB
testcase_14 AC 322 ms
67,808 KB
testcase_15 AC 387 ms
72,064 KB
testcase_16 AC 1,070 ms
72,736 KB
testcase_17 AC 60 ms
66,528 KB
testcase_18 AC 271 ms
82,076 KB
testcase_19 AC 1,682 ms
82,880 KB
testcase_20 AC 90 ms
70,312 KB
testcase_21 AC 552 ms
83,412 KB
testcase_22 AC 1,869 ms
70,224 KB
testcase_23 AC 1,961 ms
82,864 KB
testcase_24 AC 1,860 ms
75,944 KB
testcase_25 AC 1,862 ms
69,980 KB
testcase_26 AC 1,884 ms
68,728 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)):
    for b in range(c):
        for a in range(b):
            ans += D[(Q-pow(7,A[c],P)-pow(9,A[b],P)-pow(10,A[a],P))%P]
    D[pow(5,A[c],P)]+=1
print(ans)
0