結果

問題 No.2221 Set X
ユーザー Shirotsume
提出日時 2023-02-14 22:22:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 890 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 22,204 KB
最終ジャッジ日時 2024-07-17 10:13:12
合計ジャッジ時間 19,104 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
import time
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import random
import bisect
n = ii()

a = li()

def check(x, k):
    now = 0
    cnt = 0
    while now < n:
        cnt += 1
        if cnt > k:
            return cnt
        now = bisect.bisect_left(a, x * (a[now] // x + 1))
    return cnt

ans = 2 * n
x = 1

for i in range(2, 2 * n):
    k = ans // (i + 1)
    p = check(i, k)
    if ans > p * (i + 1):
        ans = p * (i + 1)
        x = i

print(x)
print(ans)

0