結果

問題 No.3758 Fan Meeting
コンテスト
ユーザー sig
提出日時 2026-10-09 21:36:59
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 447 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 812 ms
コンパイル使用メモリ 82,084 KB
実行使用メモリ 133,300 KB
最終ジャッジ日時 2026-10-09 21:37:16
合計ジャッジ時間 6,170 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

t = 1
#t = int(input())
from heapq import heappush, heappop
for _ in range(t):
  n,s = map(int, input().split())
  a = list(map(int, input().split()))
  a.sort(reverse = True)
  s -= 1
  cur = 0
  hq = []
  if a[0] > s:
    print(a[0])
    continue
  ma = 0
  for i in range(n):
    if s >= a[i]:
      s -= a[i]
      heappush(hq,0)
    if a[i] <= ma:
      continue
    cur = heappop(hq)
    ma = max(ma,cur+1)
    heappush(hq,cur+1)
  print(ma)
0