結果
| 問題 |
No.2221 Set X
|
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2023-02-17 23:28:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 496 bytes |
| コンパイル時間 | 272 ms |
| コンパイル使用メモリ | 82,592 KB |
| 実行使用メモリ | 86,040 KB |
| 最終ジャッジ日時 | 2024-07-19 14:41:05 |
| 合計ジャッジ時間 | 5,074 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 TLE * 1 -- * 26 |
ソースコード
n=int(input())
a=list(map(int,input().split()))
ans=10**9
ans2=-1
d=a[-1]-a[0]
for x in range(1,500):
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
def calc_big(x):
last=-1
now=0
for i in a:
if i//x!=last:
now+=x+1
last=i//x
if now>=ans:
return 10**9
return now
for x in range(500,2*10**5+10):
res=calc_big(x)
if res<ans:
ans=res
ans2=x
print(ans2)
print(ans)
とりゐ