結果

問題 No.2260 Adic Sum
ユーザー 👑 timitimi
提出日時 2023-04-15 15:16:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 186,044 KB
最終ジャッジ日時 2024-04-19 09:28:56
合計ジャッジ時間 6,393 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 41 ms
51,840 KB
testcase_04 AC 37 ms
52,128 KB
testcase_05 AC 39 ms
52,076 KB
testcase_06 AC 38 ms
52,412 KB
testcase_07 AC 38 ms
51,712 KB
testcase_08 AC 48 ms
62,208 KB
testcase_09 AC 42 ms
59,520 KB
testcase_10 AC 46 ms
61,056 KB
testcase_11 AC 37 ms
52,352 KB
testcase_12 AC 48 ms
62,464 KB
testcase_13 AC 45 ms
60,928 KB
testcase_14 AC 74 ms
84,352 KB
testcase_15 AC 89 ms
95,488 KB
testcase_16 AC 59 ms
74,112 KB
testcase_17 AC 95 ms
99,456 KB
testcase_18 AC 324 ms
161,436 KB
testcase_19 AC 338 ms
171,728 KB
testcase_20 AC 271 ms
156,476 KB
testcase_21 AC 268 ms
155,972 KB
testcase_22 AC 239 ms
158,632 KB
testcase_23 AC 185 ms
128,308 KB
testcase_24 AC 328 ms
170,676 KB
testcase_25 AC 122 ms
111,008 KB
testcase_26 AC 121 ms
110,976 KB
testcase_27 AC 125 ms
108,032 KB
testcase_28 AC 122 ms
111,828 KB
testcase_29 AC 123 ms
110,260 KB
testcase_30 AC 123 ms
98,492 KB
testcase_31 AC 235 ms
101,304 KB
testcase_32 AC 233 ms
100,408 KB
testcase_33 AC 99 ms
93,772 KB
testcase_34 AC 107 ms
94,484 KB
testcase_35 AC 481 ms
186,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P=map(int, input().split())
A=list(map(int, input().split()))
ans=0
for i in range(1,100):
  D={}
  PP=pow(P,i)
  for a in A:
    b=a%PP 
    if b not in D:
      D[b]=0
    D[b]+=1
  for d in D:
    ans+=D[d]*(D[d]-1)
  if len(D)==N:
    break
print(ans//2)
0