結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 22:48:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 167,688 KB
最終ジャッジ日時 2023-09-26 20:10:00
合計ジャッジ時間 29,894 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
167,688 KB
testcase_01 AC 78 ms
75,864 KB
testcase_02 AC 80 ms
75,980 KB
testcase_03 AC 78 ms
75,828 KB
testcase_04 AC 81 ms
76,172 KB
testcase_05 AC 78 ms
76,216 KB
testcase_06 AC 83 ms
75,876 KB
testcase_07 AC 81 ms
75,960 KB
testcase_08 WA -
testcase_09 AC 82 ms
75,964 KB
testcase_10 WA -
testcase_11 AC 83 ms
76,268 KB
testcase_12 AC 84 ms
76,136 KB
testcase_13 AC 84 ms
76,288 KB
testcase_14 AC 89 ms
76,292 KB
testcase_15 AC 88 ms
76,208 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 824 ms
82,524 KB
testcase_22 AC 1,241 ms
86,044 KB
testcase_23 AC 116 ms
76,204 KB
testcase_24 AC 735 ms
82,428 KB
testcase_25 AC 427 ms
79,300 KB
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(a):
  ans=10**9
  ans2=-1
  kouho=set()
  n=len(a)
  for i in range(1,500):
    kouho.add(i)
    for j in range(-2,3):
      if n//i+j>0:
        kouho.add(n//i+j)
  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