結果

問題 No.2260 Adic Sum
ユーザー yabityabit
提出日時 2023-06-28 12:25:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 339 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 86,436 KB
実行使用メモリ 78,984 KB
最終ジャッジ日時 2023-09-18 14:38:39
合計ジャッジ時間 6,783 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,788 KB
testcase_01 AC 106 ms
76,612 KB
testcase_02 AC 98 ms
71,460 KB
testcase_03 AC 96 ms
71,592 KB
testcase_04 AC 97 ms
71,664 KB
testcase_05 AC 95 ms
71,236 KB
testcase_06 AC 97 ms
71,700 KB
testcase_07 AC 97 ms
71,792 KB
testcase_08 AC 219 ms
78,984 KB
testcase_09 AC 147 ms
78,224 KB
testcase_10 AC 193 ms
78,864 KB
testcase_11 AC 123 ms
78,108 KB
testcase_12 AC 192 ms
78,572 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