結果

問題 No.2221 Set X
ユーザー stoqstoq
提出日時 2022-05-27 13:29:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 491 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 90,892 KB
最終ジャッジ日時 2023-09-14 15:55:00
合計ジャッジ時間 14,736 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,512 KB
testcase_01 AC 75 ms
71,136 KB
testcase_02 AC 73 ms
71,364 KB
testcase_03 AC 74 ms
71,364 KB
testcase_04 AC 74 ms
71,404 KB
testcase_05 AC 72 ms
71,356 KB
testcase_06 AC 73 ms
71,388 KB
testcase_07 AC 75 ms
71,528 KB
testcase_08 AC 90 ms
75,912 KB
testcase_09 AC 79 ms
75,504 KB
testcase_10 AC 91 ms
76,172 KB
testcase_11 AC 89 ms
75,968 KB
testcase_12 AC 89 ms
75,992 KB
testcase_13 AC 90 ms
76,220 KB
testcase_14 AC 93 ms
76,208 KB
testcase_15 AC 93 ms
76,064 KB
testcase_16 AC 239 ms
80,048 KB
testcase_17 AC 147 ms
77,344 KB
testcase_18 AC 265 ms
80,768 KB
testcase_19 AC 143 ms
77,280 KB
testcase_20 AC 190 ms
78,452 KB
testcase_21 AC 257 ms
82,460 KB
testcase_22 AC 327 ms
85,484 KB
testcase_23 AC 99 ms
77,084 KB
testcase_24 AC 240 ms
82,240 KB
testcase_25 AC 185 ms
79,480 KB
testcase_26 AC 450 ms
89,948 KB
testcase_27 AC 487 ms
90,708 KB
testcase_28 AC 491 ms
90,568 KB
testcase_29 AC 391 ms
90,628 KB
testcase_30 AC 407 ms
90,600 KB
testcase_31 AC 485 ms
90,832 KB
testcase_32 AC 354 ms
90,772 KB
testcase_33 AC 382 ms
90,892 KB
testcase_34 AC 367 ms
90,556 KB
testcase_35 AC 358 ms
90,748 KB
testcase_36 AC 390 ms
90,632 KB
testcase_37 AC 396 ms
90,544 KB
testcase_38 AC 388 ms
90,800 KB
testcase_39 AC 421 ms
88,260 KB
testcase_40 AC 470 ms
88,936 KB
testcase_41 AC 442 ms
90,528 KB
testcase_42 AC 438 ms
90,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

input = stdin.readline

n = int(input())
a = list(map(int, input().split()))
a.append(int(2e9))

Min = int(1e18)
Minx = -1


def lower_bound(lo, val):
    hi = n + 1
    while hi - lo > 1:
        mi = (lo + hi) // 2
        if a[mi] >= val:
            hi = mi
        else:
            lo = mi
    return hi


for x in range(1, n * 2 + 1):
    i = 0
    k = 0
    while i < n:
        i = lower_bound(i, (a[i] // x + 1) * x)
        k += 1
        if (x + 1) * k >= Min:
            k = -1
            break
    if k != -1 and (x + 1) * k < Min:
        Min = (x + 1) * k
        Minx = x
print(Minx)
print(Min)
0