結果

問題 No.2260 Adic Sum
ユーザー mkawa2mkawa2
提出日時 2023-04-07 21:31:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 469 ms / 2,000 ms
コード長 893 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 179,080 KB
最終ジャッジ日時 2024-04-15 23:44:13
合計ジャッジ時間 6,027 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
54,316 KB
testcase_01 AC 45 ms
54,676 KB
testcase_02 AC 45 ms
54,848 KB
testcase_03 AC 45 ms
54,364 KB
testcase_04 AC 45 ms
53,664 KB
testcase_05 AC 46 ms
54,456 KB
testcase_06 AC 46 ms
54,272 KB
testcase_07 AC 46 ms
54,424 KB
testcase_08 AC 57 ms
63,932 KB
testcase_09 AC 52 ms
61,488 KB
testcase_10 AC 55 ms
63,496 KB
testcase_11 AC 45 ms
54,508 KB
testcase_12 AC 57 ms
65,724 KB
testcase_13 AC 52 ms
63,444 KB
testcase_14 AC 68 ms
79,564 KB
testcase_15 AC 77 ms
85,312 KB
testcase_16 AC 64 ms
75,704 KB
testcase_17 AC 80 ms
88,352 KB
testcase_18 AC 285 ms
153,668 KB
testcase_19 AC 307 ms
163,544 KB
testcase_20 AC 224 ms
143,448 KB
testcase_21 AC 236 ms
142,676 KB
testcase_22 AC 211 ms
144,608 KB
testcase_23 AC 167 ms
114,468 KB
testcase_24 AC 312 ms
162,216 KB
testcase_25 AC 97 ms
101,824 KB
testcase_26 AC 93 ms
98,264 KB
testcase_27 AC 96 ms
102,384 KB
testcase_28 AC 95 ms
101,808 KB
testcase_29 AC 97 ms
102,560 KB
testcase_30 AC 106 ms
90,104 KB
testcase_31 AC 211 ms
90,244 KB
testcase_32 AC 207 ms
89,956 KB
testcase_33 AC 103 ms
92,328 KB
testcase_34 AC 171 ms
137,976 KB
testcase_35 AC 469 ms
179,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

from collections import Counter

n,sp=LI()
aa=LI()

p=sp
ans=0
while p<10**9:
    cnt=Counter()
    for a in aa:cnt[a%p]+=1
    for c in cnt.values():ans+=c*(c-1)//2
    p*=sp

print(ans)
0