結果

問題 No.2709 1975 Powers
ユーザー shobonvipshobonvip
提出日時 2024-04-01 01:32:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 164,508 KB
最終ジャッジ日時 2024-04-01 01:33:04
合計ジャッジ時間 6,050 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
124,116 KB
testcase_01 AC 91 ms
124,116 KB
testcase_02 AC 117 ms
134,304 KB
testcase_03 AC 153 ms
131,484 KB
testcase_04 AC 206 ms
147,344 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 99 ms
124,116 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 99 ms
124,116 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 122 ms
132,892 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 209 ms
143,924 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 198 ms
141,220 KB
testcase_26 AC 186 ms
139,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p,q=map(int,input().split())
a=list(map(int,input().split()))
mx=2000008
p10=[0]*mx
p09=[0]*mx
p07=[0]*mx
p05=[0]*mx
p10[0]=1
p09[0]=1
p07[0]=1
p05[0]=1
for i in range(1,mx):
	p10[i]=p10[i-1]*10%p
	p09[i]=p09[i-1]* 9%p
	p07[i]=p07[i-1]* 7%p
	p05[i]=p05[i-1]* 5%p

from collections import defaultdict
d=defaultdict(int)
ans=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			g=(p09[a[i]]+p07[a[j]]+p05[a[k]])%p
			#g+?=q
			#g+?=p+q
			ans+=d[p+q-g]+d[q-g]
	d[p10[a[i]]]+=1
print(ans)
0