結果
問題 |
No.2260 Adic Sum
|
ユーザー |
|
提出日時 | 2023-04-07 21:34:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,374 ms / 2,000 ms |
コード長 | 460 bytes |
コンパイル時間 | 307 ms |
コンパイル使用メモリ | 82,220 KB |
実行使用メモリ | 281,752 KB |
最終ジャッジ日時 | 2024-10-06 07:07:41 |
合計ジャッジ時間 | 24,906 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n,p = map(int,input().split()) a = list(map(int,input().split())) ans = 0 for i in range(1,60): d = defaultdict(int) now = pow(p,i) for i in range(n): ans += d[a[i] % now] d[a[i] % now] += 1 print(ans)