結果

問題 No.2260 Adic Sum
ユーザー sotanishysotanishy
提出日時 2023-03-26 12:54:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 496 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 200,740 KB
最終ジャッジ日時 2024-04-15 23:36:06
合計ジャッジ時間 6,271 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,524 KB
testcase_01 AC 42 ms
55,316 KB
testcase_02 AC 42 ms
54,024 KB
testcase_03 AC 42 ms
54,312 KB
testcase_04 AC 41 ms
54,616 KB
testcase_05 AC 41 ms
54,844 KB
testcase_06 AC 42 ms
53,496 KB
testcase_07 AC 43 ms
54,772 KB
testcase_08 AC 58 ms
63,980 KB
testcase_09 AC 46 ms
61,696 KB
testcase_10 AC 52 ms
64,008 KB
testcase_11 AC 42 ms
54,196 KB
testcase_12 AC 55 ms
64,812 KB
testcase_13 AC 48 ms
62,992 KB
testcase_14 AC 64 ms
77,948 KB
testcase_15 AC 71 ms
85,952 KB
testcase_16 AC 58 ms
75,308 KB
testcase_17 AC 73 ms
87,712 KB
testcase_18 AC 321 ms
181,404 KB
testcase_19 AC 345 ms
192,888 KB
testcase_20 AC 250 ms
144,100 KB
testcase_21 AC 255 ms
142,828 KB
testcase_22 AC 227 ms
159,456 KB
testcase_23 AC 161 ms
114,660 KB
testcase_24 AC 351 ms
191,276 KB
testcase_25 AC 93 ms
102,068 KB
testcase_26 AC 90 ms
99,228 KB
testcase_27 AC 93 ms
102,520 KB
testcase_28 AC 92 ms
102,012 KB
testcase_29 AC 93 ms
102,020 KB
testcase_30 AC 98 ms
90,548 KB
testcase_31 AC 324 ms
146,404 KB
testcase_32 AC 326 ms
145,016 KB
testcase_33 AC 93 ms
92,616 KB
testcase_34 AC 167 ms
138,248 KB
testcase_35 AC 496 ms
200,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
input = sys.stdin.readline

N, P = map(int, input().split())
A = list(map(int, input().split()))
p = P
ans = 0
while p <= 10**10:
    cnt = defaultdict(int)
    for x in A:
        r = x % p
        ans += cnt[r]
        cnt[r] += 1
    p *= P
print(ans)
0