結果

問題 No.2260 Adic Sum
ユーザー fiblonariafiblonaria
提出日時 2023-04-11 00:27:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 540 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 178,420 KB
最終ジャッジ日時 2024-04-16 02:05:21
合計ジャッジ時間 6,709 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,968 KB
testcase_01 AC 43 ms
51,968 KB
testcase_02 AC 42 ms
51,712 KB
testcase_03 AC 45 ms
51,712 KB
testcase_04 AC 43 ms
51,712 KB
testcase_05 AC 42 ms
51,712 KB
testcase_06 AC 43 ms
51,712 KB
testcase_07 AC 43 ms
51,840 KB
testcase_08 AC 52 ms
59,904 KB
testcase_09 AC 44 ms
52,352 KB
testcase_10 AC 50 ms
59,264 KB
testcase_11 AC 43 ms
51,712 KB
testcase_12 AC 58 ms
61,952 KB
testcase_13 AC 53 ms
60,928 KB
testcase_14 AC 75 ms
76,160 KB
testcase_15 AC 86 ms
84,096 KB
testcase_16 AC 72 ms
73,984 KB
testcase_17 AC 89 ms
86,784 KB
testcase_18 AC 342 ms
147,260 KB
testcase_19 AC 369 ms
157,900 KB
testcase_20 AC 276 ms
156,664 KB
testcase_21 AC 280 ms
154,564 KB
testcase_22 AC 248 ms
144,316 KB
testcase_23 AC 191 ms
114,156 KB
testcase_24 AC 345 ms
157,252 KB
testcase_25 AC 109 ms
101,120 KB
testcase_26 AC 105 ms
97,792 KB
testcase_27 AC 112 ms
101,760 KB
testcase_28 AC 111 ms
101,248 KB
testcase_29 AC 110 ms
101,120 KB
testcase_30 AC 117 ms
92,416 KB
testcase_31 AC 220 ms
90,624 KB
testcase_32 AC 223 ms
90,368 KB
testcase_33 AC 113 ms
93,696 KB
testcase_34 AC 151 ms
109,008 KB
testcase_35 AC 540 ms
178,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P = map(int, input().split())
A = list(map(int, input().split()))
ans, temp, M = 0, P, max(A)
while temp <= M:
	d = {}
	for i in A:
		d[i % temp] = d.get(i % temp, 0) + 1
	for i in d:
		ans += d[i] * (d[i] - 1) // 2
	temp *= P
print(ans)
0