結果

問題 No.2260 Adic Sum
ユーザー ああいいああいい
提出日時 2023-04-08 16:02:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 847 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 215,980 KB
最終ジャッジ日時 2024-04-16 00:01:40
合計ジャッジ時間 8,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,760 KB
testcase_01 AC 45 ms
53,888 KB
testcase_02 AC 45 ms
53,888 KB
testcase_03 AC 45 ms
54,272 KB
testcase_04 AC 45 ms
53,760 KB
testcase_05 AC 45 ms
53,632 KB
testcase_06 AC 44 ms
53,504 KB
testcase_07 AC 45 ms
53,504 KB
testcase_08 AC 57 ms
64,384 KB
testcase_09 AC 54 ms
62,080 KB
testcase_10 AC 56 ms
63,872 KB
testcase_11 AC 47 ms
54,272 KB
testcase_12 AC 61 ms
65,536 KB
testcase_13 AC 55 ms
63,232 KB
testcase_14 AC 74 ms
78,976 KB
testcase_15 AC 86 ms
86,656 KB
testcase_16 AC 68 ms
75,904 KB
testcase_17 AC 87 ms
89,344 KB
testcase_18 AC 475 ms
166,720 KB
testcase_19 AC 498 ms
171,596 KB
testcase_20 AC 352 ms
142,996 KB
testcase_21 AC 353 ms
141,920 KB
testcase_22 AC 345 ms
146,032 KB
testcase_23 AC 213 ms
115,692 KB
testcase_24 AC 496 ms
160,748 KB
testcase_25 AC 102 ms
103,808 KB
testcase_26 AC 98 ms
100,588 KB
testcase_27 AC 110 ms
103,828 KB
testcase_28 AC 107 ms
103,936 KB
testcase_29 AC 110 ms
107,136 KB
testcase_30 AC 123 ms
91,136 KB
testcase_31 AC 420 ms
91,648 KB
testcase_32 AC 396 ms
91,776 KB
testcase_33 AC 117 ms
93,244 KB
testcase_34 AC 207 ms
139,164 KB
testcase_35 AC 847 ms
215,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P = map(int,input().split())
A = list(map(int,input().split()))

l = []
C = 10 ** 9
u = P
while u <= C:
    l.append(u)
    u *= P
from collections import defaultdict
d = [defaultdict(int) for _ in range(len(l))]
ans =0
for a in A:
    for i in range(len(l)):
        p = l[i]
        r = a % p
        ans += d[i][r]
        d[i][r] += 1
print(ans)
0