結果
問題 | No.2260 Adic Sum |
ユーザー |
![]() |
提出日時 | 2023-04-07 21:45:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 278 ms |
コンパイル使用メモリ | 82,592 KB |
実行使用メモリ | 137,056 KB |
最終ジャッジ日時 | 2024-10-06 07:12:17 |
合計ジャッジ時間 | 4,270 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
from collections import defaultdict def calc(L): ret = 0 D = defaultdict(list) for a in L: D[a % P].append(a // P) for k, v in D.items(): l = len(v) ret += l * (l - 1) // 2 if l > 1: ret += calc(v) return ret N, P = map(int, input().split()) A = [int(a) for a in input().split()] print(calc(A))