結果

問題 No.2709 1975 Powers
ユーザー sepa38sepa38
提出日時 2024-03-31 13:46:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-03-31 13:46:13
合計ジャッジ時間 5,142 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,112 KB
testcase_01 AC 28 ms
10,112 KB
testcase_02 AC 53 ms
10,624 KB
testcase_03 AC 196 ms
10,368 KB
testcase_04 AC 245 ms
10,624 KB
testcase_05 AC 218 ms
10,496 KB
testcase_06 AC 117 ms
10,240 KB
testcase_07 AC 32 ms
10,624 KB
testcase_08 AC 128 ms
10,624 KB
testcase_09 AC 211 ms
10,496 KB
testcase_10 AC 35 ms
10,624 KB
testcase_11 AC 56 ms
10,240 KB
testcase_12 AC 81 ms
10,752 KB
testcase_13 AC 224 ms
10,624 KB
testcase_14 AC 91 ms
10,240 KB
testcase_15 AC 104 ms
10,752 KB
testcase_16 AC 174 ms
10,240 KB
testcase_17 AC 40 ms
10,368 KB
testcase_18 AC 87 ms
10,752 KB
testcase_19 AC 242 ms
10,496 KB
testcase_20 AC 46 ms
10,624 KB
testcase_21 AC 129 ms
10,624 KB
testcase_22 AC 274 ms
10,624 KB
testcase_23 AC 271 ms
10,496 KB
testcase_24 AC 254 ms
10,240 KB
testcase_25 AC 292 ms
10,496 KB
testcase_26 AC 273 ms
10,496 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