結果

問題 No.2260 Adic Sum
ユーザー ニックネームニックネーム
提出日時 2023-04-07 21:32:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,420 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,344 KB
最終ジャッジ日時 2024-04-15 23:45:04
合計ジャッジ時間 11,317 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 29 ms
11,008 KB
testcase_11 AC 29 ms
10,752 KB
testcase_12 AC 31 ms
11,008 KB
testcase_13 AC 32 ms
11,264 KB
testcase_14 AC 71 ms
16,344 KB
testcase_15 AC 91 ms
19,164 KB
testcase_16 AC 65 ms
16,680 KB
testcase_17 AC 100 ms
20,668 KB
testcase_18 AC 864 ms
27,944 KB
testcase_19 AC 920 ms
28,296 KB
testcase_20 AC 616 ms
28,248 KB
testcase_21 AC 623 ms
28,296 KB
testcase_22 AC 568 ms
27,732 KB
testcase_23 AC 387 ms
28,152 KB
testcase_24 AC 913 ms
28,344 KB
testcase_25 AC 137 ms
26,092 KB
testcase_26 AC 133 ms
25,960 KB
testcase_27 AC 138 ms
26,304 KB
testcase_28 AC 130 ms
26,164 KB
testcase_29 AC 135 ms
26,072 KB
testcase_30 AC 150 ms
22,080 KB
testcase_31 AC 896 ms
22,092 KB
testcase_32 AC 886 ms
22,100 KB
testcase_33 AC 165 ms
26,960 KB
testcase_34 AC 307 ms
28,256 KB
testcase_35 AC 1,420 ms
28,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
x,p = map(int,input().split())
a = list(map(int,input().split()))
q = p; m = max(a); ans = 0
while q<m:
    r = defaultdict(int)
    for v in a: r[v%q] += 1
    for v in r.values(): ans += v*(v-1)//2
    q *= p
print(ans)
0