結果

問題 No.2260 Adic Sum
ユーザー karinohitokarinohito
提出日時 2023-03-20 01:26:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 598 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 179,204 KB
最終ジャッジ日時 2024-04-15 23:37:01
合計ジャッジ時間 6,957 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,168 KB
testcase_01 AC 46 ms
54,764 KB
testcase_02 AC 45 ms
54,312 KB
testcase_03 AC 45 ms
54,984 KB
testcase_04 AC 45 ms
53,792 KB
testcase_05 AC 44 ms
53,940 KB
testcase_06 AC 45 ms
53,720 KB
testcase_07 AC 45 ms
54,244 KB
testcase_08 AC 58 ms
65,776 KB
testcase_09 AC 52 ms
61,400 KB
testcase_10 AC 56 ms
63,992 KB
testcase_11 AC 47 ms
55,160 KB
testcase_12 AC 60 ms
65,720 KB
testcase_13 AC 54 ms
63,744 KB
testcase_14 AC 71 ms
78,404 KB
testcase_15 AC 80 ms
86,708 KB
testcase_16 AC 65 ms
76,864 KB
testcase_17 AC 83 ms
89,048 KB
testcase_18 AC 358 ms
158,168 KB
testcase_19 AC 382 ms
167,384 KB
testcase_20 AC 278 ms
142,676 KB
testcase_21 AC 284 ms
142,336 KB
testcase_22 AC 252 ms
144,996 KB
testcase_23 AC 192 ms
114,572 KB
testcase_24 AC 373 ms
165,128 KB
testcase_25 AC 100 ms
103,492 KB
testcase_26 AC 98 ms
100,036 KB
testcase_27 AC 102 ms
103,588 KB
testcase_28 AC 101 ms
103,236 KB
testcase_29 AC 100 ms
103,136 KB
testcase_30 AC 111 ms
91,144 KB
testcase_31 AC 351 ms
91,176 KB
testcase_32 AC 354 ms
90,924 KB
testcase_33 AC 109 ms
92,680 KB
testcase_34 AC 211 ms
138,624 KB
testcase_35 AC 598 ms
179,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N,P=map(int,input().split())
A = list(map(int,input().split()))
an=0
p=P
while p<10**9+3:
    M=defaultdict(int)
    for i in range(N):
        an=an+M[A[i]%p]
        M[A[i]%p]=M[A[i]%p]+1
    p=p*P
print(an)
0