結果

問題 No.2260 Adic Sum
ユーザー ShirotsumeShirotsume
提出日時 2023-04-07 21:32:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 445 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 191,452 KB
最終ジャッジ日時 2024-04-15 23:45:11
合計ジャッジ時間 6,152 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,888 KB
testcase_01 AC 44 ms
53,504 KB
testcase_02 AC 47 ms
53,632 KB
testcase_03 AC 44 ms
53,504 KB
testcase_04 AC 44 ms
53,504 KB
testcase_05 AC 45 ms
53,632 KB
testcase_06 AC 44 ms
53,504 KB
testcase_07 AC 44 ms
54,272 KB
testcase_08 AC 52 ms
62,208 KB
testcase_09 AC 48 ms
59,136 KB
testcase_10 AC 52 ms
61,824 KB
testcase_11 AC 45 ms
54,144 KB
testcase_12 AC 58 ms
64,512 KB
testcase_13 AC 53 ms
62,976 KB
testcase_14 AC 69 ms
78,848 KB
testcase_15 AC 78 ms
86,656 KB
testcase_16 AC 66 ms
76,160 KB
testcase_17 AC 82 ms
89,344 KB
testcase_18 AC 305 ms
167,992 KB
testcase_19 AC 327 ms
177,412 KB
testcase_20 AC 241 ms
151,704 KB
testcase_21 AC 244 ms
151,596 KB
testcase_22 AC 221 ms
150,512 KB
testcase_23 AC 175 ms
118,408 KB
testcase_24 AC 310 ms
174,028 KB
testcase_25 AC 98 ms
103,808 KB
testcase_26 AC 95 ms
100,864 KB
testcase_27 AC 99 ms
104,532 KB
testcase_28 AC 98 ms
104,064 KB
testcase_29 AC 99 ms
104,064 KB
testcase_30 AC 107 ms
92,544 KB
testcase_31 AC 247 ms
94,504 KB
testcase_32 AC 245 ms
93,848 KB
testcase_33 AC 105 ms
93,472 KB
testcase_34 AC 145 ms
112,744 KB
testcase_35 AC 445 ms
191,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, p = mi()
A = li()

nowp = 1
ans = 0
for _ in range(60):
    nowp *= p
    if nowp > max(A):
        break
    a = Counter([v % nowp for v in A])
    for v, c in a.items():
        ans += c * (c - 1) // 2
print(ans)

0