結果
| 問題 | No.1233 割り切れない気持ち |
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2025-09-13 00:08:01 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 749 ms / 3,153 ms |
| + 699µs | |
| コード長 | 621 bytes |
| 記録 | |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 95,976 KB |
| 実行使用メモリ | 167,776 KB |
| 最終ジャッジ日時 | 2026-07-15 01:17:40 |
| 合計ジャッジ時間 | 13,137 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 39 |
ソースコード
# https://yukicoder.me/problems/no/1233
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 sorted(c.items()):
ans += SUM * v
SUM += k*v
# (大,小)
for k,v in c.items():
tmp = 0
left = bisect.bisect_left(A,k)
for j in range(1,10**18):
if(k*j > A[-1]):break
right = bisect.bisect_left(A,k*(j+1))
tmp += (S[right] - S[left]) - k * j * (right-left)
left = right
ans += tmp * v
print(ans)
回転