結果

問題 No.2260 Adic Sum
ユーザー とりゐとりゐ
提出日時 2023-04-08 20:55:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 638 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 211,276 KB
最終ジャッジ日時 2024-04-16 00:02:20
合計ジャッジ時間 13,503 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
53,760 KB
testcase_01 AC 48 ms
53,888 KB
testcase_02 AC 47 ms
53,504 KB
testcase_03 AC 47 ms
54,016 KB
testcase_04 AC 55 ms
60,544 KB
testcase_05 AC 53 ms
60,672 KB
testcase_06 AC 53 ms
60,800 KB
testcase_07 AC 53 ms
60,672 KB
testcase_08 AC 80 ms
76,288 KB
testcase_09 AC 62 ms
66,560 KB
testcase_10 AC 74 ms
73,600 KB
testcase_11 AC 62 ms
64,512 KB
testcase_12 AC 76 ms
74,112 KB
testcase_13 AC 83 ms
76,800 KB
testcase_14 AC 259 ms
106,724 KB
testcase_15 AC 362 ms
128,136 KB
testcase_16 AC 232 ms
104,220 KB
testcase_17 AC 402 ms
135,724 KB
testcase_18 AC 552 ms
198,960 KB
testcase_19 AC 589 ms
211,276 KB
testcase_20 AC 597 ms
210,076 KB
testcase_21 AC 613 ms
203,280 KB
testcase_22 AC 638 ms
200,112 KB
testcase_23 AC 586 ms
157,852 KB
testcase_24 AC 580 ms
207,504 KB
testcase_25 AC 604 ms
176,412 KB
testcase_26 AC 570 ms
163,928 KB
testcase_27 AC 619 ms
174,012 KB
testcase_28 AC 599 ms
173,728 KB
testcase_29 AC 612 ms
178,852 KB
testcase_30 AC 606 ms
169,788 KB
testcase_31 AC 292 ms
90,880 KB
testcase_32 AC 290 ms
91,008 KB
testcase_33 AC 524 ms
170,436 KB
testcase_34 AC 521 ms
182,284 KB
testcase_35 AC 539 ms
179,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input=lambda :stdin.readline()[:-1]

from collections import defaultdict, deque

n,p=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,30):
  mod=p**i
  cnt=defaultdict(int)
  for j in a:
    ans+=cnt[j%mod]
    cnt[j%mod]+=1
    
print(ans)
0