結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 23:28:50
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 496 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 76,204 KB
最終ジャッジ日時 2023-09-26 20:51:44
合計ジャッジ時間 6,126 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,004 KB
testcase_01 AC 78 ms
75,960 KB
testcase_02 AC 79 ms
75,788 KB
testcase_03 AC 77 ms
75,964 KB
testcase_04 AC 80 ms
75,844 KB
testcase_05 AC 75 ms
75,928 KB
testcase_06 AC 79 ms
75,992 KB
testcase_07 AC 77 ms
75,992 KB
testcase_08 AC 81 ms
75,876 KB
testcase_09 AC 82 ms
75,960 KB
testcase_10 AC 87 ms
76,012 KB
testcase_11 AC 83 ms
75,968 KB
testcase_12 AC 79 ms
76,204 KB
testcase_13 AC 83 ms
75,764 KB
testcase_14 AC 94 ms
75,876 KB
testcase_15 AC 84 ms
75,964 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

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
      last=i//x
      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