結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 22:07:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 83,784 KB
最終ジャッジ日時 2023-09-26 19:23:37
合計ジャッジ時間 6,015 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,144 KB
testcase_01 AC 75 ms
70,928 KB
testcase_02 AC 74 ms
70,860 KB
testcase_03 AC 74 ms
70,856 KB
testcase_04 WA -
testcase_05 AC 74 ms
70,884 KB
testcase_06 WA -
testcase_07 AC 74 ms
70,836 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 82 ms
75,020 KB
testcase_14 AC 91 ms
75,252 KB
testcase_15 AC 84 ms
75,128 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 #

def divisors(n):
  lower,upper=[],[]
  i=1
  while i*i<=n:
    if n%i==0:
      lower.append(i)
      if i!=n//i:
        upper.append(n//i)
    i+=1
  return lower+upper[::-1]

def solve(a):
  ans=10**9
  ans2=-1
  kouho=list(range(1,n+1))
  for x in kouho:
    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
  
  return ans,ans2

n=int(input())
a=list(map(int,input().split()))
ans,ans2=solve(a)
print(ans2)
print(ans)
0