結果

問題 No.2260 Adic Sum
ユーザー okapinokapin
提出日時 2023-04-07 21:54:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 179,544 KB
最終ジャッジ日時 2024-04-15 23:53:19
合計ジャッジ時間 6,153 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,688 KB
testcase_01 AC 44 ms
54,380 KB
testcase_02 AC 47 ms
55,108 KB
testcase_03 AC 45 ms
54,712 KB
testcase_04 AC 44 ms
55,252 KB
testcase_05 AC 44 ms
53,912 KB
testcase_06 AC 44 ms
54,064 KB
testcase_07 AC 44 ms
53,872 KB
testcase_08 AC 51 ms
63,684 KB
testcase_09 AC 47 ms
60,232 KB
testcase_10 AC 51 ms
61,348 KB
testcase_11 AC 44 ms
55,568 KB
testcase_12 AC 57 ms
64,572 KB
testcase_13 AC 52 ms
64,560 KB
testcase_14 AC 70 ms
79,176 KB
testcase_15 AC 79 ms
86,256 KB
testcase_16 AC 66 ms
76,320 KB
testcase_17 AC 83 ms
89,464 KB
testcase_18 AC 301 ms
155,500 KB
testcase_19 AC 324 ms
164,040 KB
testcase_20 AC 240 ms
142,676 KB
testcase_21 AC 244 ms
142,728 KB
testcase_22 AC 220 ms
144,872 KB
testcase_23 AC 176 ms
114,580 KB
testcase_24 AC 323 ms
162,004 KB
testcase_25 AC 101 ms
102,784 KB
testcase_26 AC 96 ms
99,712 KB
testcase_27 AC 101 ms
103,168 KB
testcase_28 AC 98 ms
102,912 KB
testcase_29 AC 100 ms
102,784 KB
testcase_30 AC 107 ms
91,008 KB
testcase_31 AC 219 ms
91,008 KB
testcase_32 AC 213 ms
91,052 KB
testcase_33 AC 106 ms
92,700 KB
testcase_34 AC 139 ms
109,644 KB
testcase_35 AC 481 ms
179,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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