結果
問題 |
No.1233 割り切れない気持ち
|
ユーザー |
![]() |
提出日時 | 2025-09-12 23:06:19 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 537 bytes |
コンパイル時間 | 357 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 127,892 KB |
最終ジャッジ日時 | 2025-09-12 23:44:58 |
合計ジャッジ時間 | 24,060 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 TLE * 1 -- * 13 |
ソースコード
import bisect from itertools import accumulate from collections import Counter N = int(input()) A = list(map(int,input().split())) A.sort() S = [0] + list(accumulate(A)) ans = 0 # (小,大) c = Counter(A) SUM = 0 for k,v in c.items(): ans += SUM * v SUM += k*v # (大,小) v = 0 for i in range(N): for j in range(1,10**18): if(A[i]*j > A[-1]):break right = bisect.bisect_left(A,A[i]*(j+1)) left = bisect.bisect_left(A,A[i]*j) v += (S[right] - S[left]) - A[i] * j * (right-left) print(ans+v)