結果

問題 No.2260 Adic Sum
ユーザー yabityabit
提出日時 2023-06-28 12:26:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 339 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 8,852 KB
最終ジャッジ日時 2023-09-18 14:39:54
合計ジャッジ時間 5,885 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,720 KB
testcase_01 AC 20 ms
8,608 KB
testcase_02 AC 19 ms
8,684 KB
testcase_03 AC 19 ms
8,712 KB
testcase_04 AC 19 ms
8,520 KB
testcase_05 AC 19 ms
8,548 KB
testcase_06 AC 19 ms
8,752 KB
testcase_07 AC 20 ms
8,624 KB
testcase_08 AC 459 ms
8,848 KB
testcase_09 AC 197 ms
8,824 KB
testcase_10 AC 421 ms
8,852 KB
testcase_11 AC 68 ms
8,548 KB
testcase_12 AC 426 ms
8,848 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt, ceil
from collections import defaultdict
N,P = map(int, input().split())
A = list(map(int, input().split()))
M = max(A)
ans = 0
for i in range(1, ceil(sqrt(M))+1):
    D = defaultdict(int)
    p = pow(P, i)
    for j in range(N):
        D[A[j] % p] += 1
    for v in D.values():
        ans += v*(v-1)//2
print(ans)
0