結果

問題 No.2260 Adic Sum
ユーザー rlangevinrlangevin
提出日時 2023-04-07 21:33:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 764 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 212,716 KB
最終ジャッジ日時 2024-04-15 23:46:06
合計ジャッジ時間 15,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
54,444 KB
testcase_01 AC 47 ms
54,260 KB
testcase_02 AC 47 ms
54,848 KB
testcase_03 AC 47 ms
54,332 KB
testcase_04 AC 51 ms
61,556 KB
testcase_05 AC 52 ms
62,700 KB
testcase_06 AC 52 ms
62,000 KB
testcase_07 AC 52 ms
61,528 KB
testcase_08 AC 75 ms
76,636 KB
testcase_09 AC 60 ms
68,820 KB
testcase_10 AC 74 ms
76,376 KB
testcase_11 AC 56 ms
64,744 KB
testcase_12 AC 76 ms
76,508 KB
testcase_13 AC 83 ms
76,668 KB
testcase_14 AC 303 ms
108,716 KB
testcase_15 AC 440 ms
134,672 KB
testcase_16 AC 267 ms
105,460 KB
testcase_17 AC 494 ms
143,620 KB
testcase_18 AC 586 ms
212,716 KB
testcase_19 AC 625 ms
210,584 KB
testcase_20 AC 659 ms
207,148 KB
testcase_21 AC 697 ms
202,088 KB
testcase_22 AC 712 ms
198,708 KB
testcase_23 AC 715 ms
161,812 KB
testcase_24 AC 658 ms
205,780 KB
testcase_25 AC 739 ms
191,596 KB
testcase_26 AC 701 ms
179,848 KB
testcase_27 AC 752 ms
191,708 KB
testcase_28 AC 734 ms
188,500 KB
testcase_29 AC 734 ms
191,540 KB
testcase_30 AC 764 ms
184,516 KB
testcase_31 AC 381 ms
175,072 KB
testcase_32 AC 379 ms
175,228 KB
testcase_33 AC 645 ms
183,196 KB
testcase_34 AC 596 ms
182,280 KB
testcase_35 AC 614 ms
196,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, P = map(int, input().split())
A = list(map(int, input().split()))
now = 1
ans = 0
for _ in range(35):
    now *= P
    D = defaultdict(int)
    for i in range(N):
        D[A[i]%now] += 1
    for k, v in D.items():
        ans += v * (v - 1) // 2
print(ans)
0