結果
問題 |
No.2221 Set X
|
ユーザー |
![]() |
提出日時 | 2022-05-27 15:48:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 636 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,480 KB |
最終ジャッジ日時 | 2024-07-02 06:07:31 |
合計ジャッジ時間 | 10,878 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 TLE * 2 -- * 21 |
ソースコード
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)