結果

問題 No.2260 Adic Sum
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-04-07 21:28:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 422 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 258,552 KB
最終ジャッジ日時 2024-04-15 23:41:43
合計ジャッジ時間 5,688 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,712 KB
testcase_01 AC 41 ms
51,712 KB
testcase_02 AC 40 ms
51,584 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 40 ms
52,352 KB
testcase_05 AC 40 ms
51,712 KB
testcase_06 AC 40 ms
51,712 KB
testcase_07 AC 40 ms
51,712 KB
testcase_08 AC 50 ms
61,184 KB
testcase_09 AC 44 ms
58,624 KB
testcase_10 AC 49 ms
60,544 KB
testcase_11 AC 40 ms
52,352 KB
testcase_12 AC 51 ms
61,952 KB
testcase_13 AC 46 ms
60,032 KB
testcase_14 AC 62 ms
74,368 KB
testcase_15 AC 71 ms
81,664 KB
testcase_16 AC 59 ms
71,936 KB
testcase_17 AC 72 ms
84,096 KB
testcase_18 AC 278 ms
191,404 KB
testcase_19 AC 288 ms
181,600 KB
testcase_20 AC 217 ms
156,400 KB
testcase_21 AC 217 ms
156,736 KB
testcase_22 AC 191 ms
144,092 KB
testcase_23 AC 154 ms
114,044 KB
testcase_24 AC 281 ms
154,604 KB
testcase_25 AC 87 ms
97,920 KB
testcase_26 AC 83 ms
94,848 KB
testcase_27 AC 90 ms
98,432 KB
testcase_28 AC 86 ms
97,792 KB
testcase_29 AC 86 ms
98,048 KB
testcase_30 AC 92 ms
95,616 KB
testcase_31 AC 223 ms
92,476 KB
testcase_32 AC 232 ms
92,400 KB
testcase_33 AC 91 ms
101,524 KB
testcase_34 AC 161 ms
137,648 KB
testcase_35 AC 422 ms
258,552 KB
権限があれば一括ダウンロードができます

ソースコード

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