結果

問題 No.2260 Adic Sum
ユーザー SPD_9X2
提出日時 2023-04-07 21:28:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 258,416 KB
最終ジャッジ日時 2024-10-06 07:00:16
合計ジャッジ時間 5,351 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin

N,P = map(int,stdin.readline().split())

A = list(map(int,stdin.readline().split()))

ans = 0

for i in range(1,60):

    Pi = P**i
    if Pi > 10**9:
        break

    dic = {}

    for a in A:

        d = a % Pi

        if d in dic:
            ans += dic[d]
            dic[d] += 1
        else:
            dic[d] = 1

print (ans)
0