結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 23:27:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 1,643 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 92,108 KB
最終ジャッジ日時 2023-09-26 20:50:57
合計ジャッジ時間 27,936 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
75,968 KB
testcase_01 AC 87 ms
75,928 KB
testcase_02 AC 86 ms
75,996 KB
testcase_03 AC 84 ms
75,676 KB
testcase_04 AC 85 ms
75,960 KB
testcase_05 AC 83 ms
75,528 KB
testcase_06 AC 87 ms
75,972 KB
testcase_07 AC 86 ms
76,092 KB
testcase_08 WA -
testcase_09 AC 86 ms
75,680 KB
testcase_10 WA -
testcase_11 AC 87 ms
75,940 KB
testcase_12 AC 89 ms
75,976 KB
testcase_13 AC 90 ms
76,008 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 841 ms
82,780 KB
testcase_22 AC 1,093 ms
86,200 KB
testcase_23 AC 159 ms
76,384 KB
testcase_24 AC 787 ms
82,620 KB
testcase_25 AC 541 ms
79,808 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 1,016 ms
91,696 KB
testcase_33 AC 1,423 ms
91,824 KB
testcase_34 AC 1,303 ms
91,736 KB
testcase_35 AC 1,155 ms
91,908 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

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