結果

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

ソースコード

diff #

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

ans=10**9
ans2=-1
d=a[-1]-a[0]
for x in range(1,500):
  last=-1
  cnt=0
  for i in a:
    if i//x!=last:
      cnt+=1
      last=i//x
  if ans>cnt*(x+1):
    ans=cnt*(x+1)
    ans2=x

def calc_big(x):
  last=-1
  now=0
  for i in a:
    if i//x!=last:
      now+=x+1
      if now>=ans:
        return 10**9
  return now

for x in range(500,2*10**5+10):
  res=calc_big(x)
  if res<ans:
    ans=res
    ans2=x

print(ans2)
print(ans)
0