結果

問題 No.2709 1975 Powers
ユーザー sepa38sepa38
提出日時 2024-02-06 20:15:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 62,644 KB
最終ジャッジ日時 2024-02-06 20:15:56
合計ジャッジ時間 3,884 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 52 ms
62,576 KB
testcase_03 AC 89 ms
62,280 KB
testcase_04 AC 103 ms
62,484 KB
testcase_05 AC 109 ms
62,412 KB
testcase_06 AC 72 ms
62,096 KB
testcase_07 AC 38 ms
54,100 KB
testcase_08 AC 74 ms
62,564 KB
testcase_09 AC 93 ms
62,468 KB
testcase_10 AC 38 ms
54,100 KB
testcase_11 AC 54 ms
62,148 KB
testcase_12 AC 60 ms
62,644 KB
testcase_13 AC 94 ms
62,596 KB
testcase_14 AC 65 ms
62,228 KB
testcase_15 AC 68 ms
62,628 KB
testcase_16 AC 88 ms
62,196 KB
testcase_17 AC 40 ms
53,844 KB
testcase_18 AC 61 ms
62,628 KB
testcase_19 AC 102 ms
62,420 KB
testcase_20 AC 51 ms
62,608 KB
testcase_21 AC 71 ms
62,564 KB
testcase_22 AC 106 ms
62,572 KB
testcase_23 AC 106 ms
62,428 KB
testcase_24 AC 105 ms
62,192 KB
testcase_25 AC 108 ms
62,404 KB
testcase_26 AC 133 ms
62,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p, q = map(int, input().split())
a = sorted(list(map(int, input().split())))
cnt = [0] * p
for i in range(n):
  for j in range(i+1, n):
    cnt[(pow(7, a[i], p)+pow(5, a[j], p))%p] += 1
ans = 0
for i in range(n):
  for j in range(i+1, n):
    cnt[(pow(7, a[i], p)+pow(5, a[j], p))%p] -= 1
  for j in range(0, i):
    ans += cnt[(q-pow(10, a[j], p)-pow(9, a[i], p))%p]
print(ans)
0