結果

問題 No.2221 Set X
ユーザー flygonflygon
提出日時 2023-02-18 16:13:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 585 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 90,752 KB
最終ジャッジ日時 2024-07-20 02:05:40
合計ジャッジ時間 13,321 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n = int(input())
a = list(map(int,input().split()))
a.append(10**10)

ans = [2*n, 1]
for i in range(2, 2*n+1):
  j = 0
  cnt = 0
  while j < n:
    now = a[j]//i
    t = bisect_left(a, i*(now+1))
    j = t
    cnt += 1
    if (i+1) * cnt >= 2*n:
      break
  ans = min(ans, [cnt * (i+1), i])

print(ans[1])
print(ans[0])

0