結果

問題 No.2221 Set X
ユーザー とりゐとりゐ
提出日時 2023-02-17 22:44:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 91,596 KB
最終ジャッジ日時 2023-09-26 20:02:43
合計ジャッジ時間 14,455 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,348 KB
testcase_01 AC 72 ms
71,420 KB
testcase_02 AC 72 ms
71,304 KB
testcase_03 AC 72 ms
71,176 KB
testcase_04 AC 73 ms
71,324 KB
testcase_05 AC 73 ms
71,148 KB
testcase_06 AC 73 ms
71,312 KB
testcase_07 AC 71 ms
71,344 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 78 ms
75,700 KB
testcase_14 AC 78 ms
75,632 KB
testcase_15 AC 78 ms
75,852 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 169 ms
82,744 KB
testcase_22 AC 238 ms
86,144 KB
testcase_23 AC 89 ms
76,396 KB
testcase_24 AC 215 ms
82,228 KB
testcase_25 AC 196 ms
79,440 KB
testcase_26 AC 653 ms
90,132 KB
testcase_27 AC 1,269 ms
91,508 KB
testcase_28 WA -
testcase_29 AC 621 ms
91,596 KB
testcase_30 AC 556 ms
91,444 KB
testcase_31 AC 659 ms
91,488 KB
testcase_32 AC 507 ms
91,552 KB
testcase_33 AC 938 ms
91,444 KB
testcase_34 AC 395 ms
91,316 KB
testcase_35 AC 759 ms
91,436 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

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]

n=int(input())
a=list(map(int,input().split()))
block=[]
now=a[0]
L=a[0]
g=a[0]
from math import gcd
for i in range(1,n):
  if a[i]-a[i-1]!=1:
    g=gcd(g,a[i])

ans=10**9
ans2=-1
kouho=set()
for d in divisors(len(a)):
  for i in range(-5,6):
    if d+i>0:
      kouho.add(d+i)
for i in range(10):
  kouho.add(2*len(a)+i)
if g!=0:
  for i in divisors(g):
    kouho.add(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

print(ans2)
print(ans)
0