結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 23:07:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 91,404 KB
最終ジャッジ日時 2023-09-26 20:29:47
合計ジャッジ時間 45,296 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,460 KB
testcase_01 AC 74 ms
75,348 KB
testcase_02 AC 75 ms
75,604 KB
testcase_03 AC 73 ms
75,440 KB
testcase_04 AC 76 ms
75,628 KB
testcase_05 AC 70 ms
71,012 KB
testcase_06 AC 75 ms
75,540 KB
testcase_07 AC 76 ms
75,640 KB
testcase_08 AC 85 ms
75,416 KB
testcase_09 AC 79 ms
75,444 KB
testcase_10 AC 85 ms
75,456 KB
testcase_11 AC 81 ms
75,604 KB
testcase_12 AC 83 ms
75,504 KB
testcase_13 AC 83 ms
75,556 KB
testcase_14 AC 89 ms
75,432 KB
testcase_15 AC 82 ms
75,460 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 733 ms
82,220 KB
testcase_22 AC 1,004 ms
85,684 KB
testcase_23 AC 127 ms
76,048 KB
testcase_24 AC 673 ms
81,928 KB
testcase_25 AC 443 ms
78,964 KB
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 1,954 ms
91,144 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 WA -
testcase_40 WA -
testcase_41 TLE -
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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