結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 22:07:41
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 518 bytes
コンパイル時間 1,431 ms
コンパイル使用メモリ 86,688 KB
実行使用メモリ 75,488 KB
最終ジャッジ日時 2023-09-26 19:24:00
合計ジャッジ時間 6,089 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,204 KB
testcase_01 AC 71 ms
71,068 KB
testcase_02 AC 69 ms
70,988 KB
testcase_03 AC 71 ms
70,636 KB
testcase_04 AC 68 ms
70,636 KB
testcase_05 AC 70 ms
70,976 KB
testcase_06 AC 70 ms
70,888 KB
testcase_07 AC 69 ms
70,864 KB
testcase_08 AC 86 ms
75,212 KB
testcase_09 AC 73 ms
74,752 KB
testcase_10 AC 85 ms
74,976 KB
testcase_11 AC 77 ms
75,168 KB
testcase_12 AC 83 ms
75,324 KB
testcase_13 AC 81 ms
75,460 KB
testcase_14 AC 106 ms
75,256 KB
testcase_15 AC 81 ms
75,488 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,2*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