結果

問題 No.2221 Set X
ユーザー Shirotsume
提出日時 2023-02-14 22:17:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 706 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 92,112 KB
最終ジャッジ日時 2024-07-17 10:09:10
合計ジャッジ時間 13,575 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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 False
        now = bisect.bisect_left(a, x * (a[now] // x + 1))
    return True

ans = 2 * n
x = 1

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

0