結果

問題 No.2221 Set X
ユーザー とりゐ
提出日時 2023-02-17 23:37:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 473 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 91,116 KB
最終ジャッジ日時 2024-07-19 14:48:33
合計ジャッジ時間 12,076 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
input=lambda :stdin.readline()[:-1]

n=int(input())
a=list(map(int,input().split()))

ans=10**9
ans2=-1

import bisect

for x in range(1,2*n+1):
  now=0
  i=0
  while i!=n:
    now+=x+1
    if now>=ans:
      break
    i=bisect.bisect_left(a,(a[i]//x+1)*x)
  if now<ans:
    ans=now
    ans2=x

print(ans2)
print(ans)
0