結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 23:18:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 91,100 KB
最終ジャッジ日時 2023-09-26 20:40:26
合計ジャッジ時間 35,745 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,608 KB
testcase_01 AC 79 ms
75,508 KB
testcase_02 AC 81 ms
75,464 KB
testcase_03 AC 77 ms
71,340 KB
testcase_04 AC 80 ms
75,564 KB
testcase_05 AC 76 ms
71,408 KB
testcase_06 AC 81 ms
75,340 KB
testcase_07 AC 80 ms
75,544 KB
testcase_08 WA -
testcase_09 AC 78 ms
75,272 KB
testcase_10 WA -
testcase_11 AC 81 ms
75,408 KB
testcase_12 WA -
testcase_13 AC 82 ms
75,380 KB
testcase_14 AC 86 ms
75,180 KB
testcase_15 AC 83 ms
75,496 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 598 ms
82,164 KB
testcase_22 AC 870 ms
85,640 KB
testcase_23 AC 110 ms
76,060 KB
testcase_24 AC 546 ms
82,120 KB
testcase_25 AC 341 ms
78,984 KB
testcase_26 AC 1,916 ms
89,820 KB
testcase_27 AC 1,916 ms
90,992 KB
testcase_28 WA -
testcase_29 AC 1,888 ms
90,952 KB
testcase_30 AC 1,785 ms
90,956 KB
testcase_31 AC 1,879 ms
91,100 KB
testcase_32 AC 1,914 ms
90,892 KB
testcase_33 AC 1,713 ms
91,036 KB
testcase_34 AC 1,783 ms
90,968 KB
testcase_35 AC 1,803 ms
91,032 KB
testcase_36 AC 1,911 ms
91,064 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 TLE -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(a):
  ans=10**9
  ans2=-1
  kouho=set()
  n=len(a)
  d=a[-1]-a[0]
  for i in range(1,400):
    kouho.add(i)
    if n>=i:
      kouho.add(n//i)
      kouho.add((n+i-1)//i)
    if d>=i and d<=i*2*10**5:
      kouho.add(d//i)
      kouho.add((d+i-1)//i)
  kouho=sorted(list(kouho))
  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()))
ans1,ans2=solve(a)

print(ans2)
print(ans1)
0