結果
問題 |
No.2221 Set X
|
ユーザー |
![]() |
提出日時 | 2023-02-17 22:07:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 516 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 82,312 KB |
実行使用メモリ | 76,456 KB |
最終ジャッジ日時 | 2024-07-19 13:18:06 |
合計ジャッジ時間 | 4,903 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 7 TLE * 1 -- * 26 |
ソースコード
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,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)