結果

問題 No.2260 Adic Sum
ユーザー hir355hir355
提出日時 2023-04-07 21:26:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 509 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 199,140 KB
最終ジャッジ日時 2024-04-15 23:39:46
合計ジャッジ時間 6,814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,504 KB
testcase_01 AC 46 ms
53,504 KB
testcase_02 AC 42 ms
53,632 KB
testcase_03 AC 42 ms
53,888 KB
testcase_04 AC 42 ms
53,632 KB
testcase_05 AC 41 ms
53,888 KB
testcase_06 AC 42 ms
54,016 KB
testcase_07 AC 43 ms
54,144 KB
testcase_08 AC 53 ms
64,256 KB
testcase_09 AC 47 ms
61,568 KB
testcase_10 AC 51 ms
63,360 KB
testcase_11 AC 48 ms
59,904 KB
testcase_12 AC 55 ms
64,768 KB
testcase_13 AC 53 ms
64,512 KB
testcase_14 AC 78 ms
85,632 KB
testcase_15 AC 90 ms
96,896 KB
testcase_16 AC 73 ms
82,304 KB
testcase_17 AC 98 ms
100,864 KB
testcase_18 AC 349 ms
195,788 KB
testcase_19 AC 371 ms
197,096 KB
testcase_20 AC 276 ms
143,488 KB
testcase_21 AC 280 ms
142,692 KB
testcase_22 AC 250 ms
159,232 KB
testcase_23 AC 182 ms
128,896 KB
testcase_24 AC 362 ms
193,180 KB
testcase_25 AC 121 ms
106,752 KB
testcase_26 AC 118 ms
103,680 KB
testcase_27 AC 126 ms
107,136 KB
testcase_28 AC 122 ms
106,752 KB
testcase_29 AC 122 ms
106,952 KB
testcase_30 AC 126 ms
100,032 KB
testcase_31 AC 331 ms
160,796 KB
testcase_32 AC 334 ms
160,732 KB
testcase_33 AC 127 ms
106,740 KB
testcase_34 AC 193 ms
152,740 KB
testcase_35 AC 509 ms
199,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n, p = map(int, input().split())
a = list(map(int, input().split()))
t = 1
ans = 0
while t <= 10 ** 10:
    t *= p
    d = defaultdict(int)
    for x in a:
        d[x % t] += 1
    for v in d.values():
        ans += v * (v - 1) // 2
print(ans)
0