結果

問題 No.1015 おつりは要らないです
ユーザー takakin
提出日時 2020-04-03 22:49:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,772 KB
最終ジャッジ日時 2024-07-03 05:16:13
合計ジャッジ時間 5,878 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,x,y,z=map(int,input().split())
A=[int(i) for i in input().split()]
t=0
chk=True
for i in range(n):
  t+=A[i]//10000
  A[i]%=10000
if z>=t:
  z-=t
else:
  t-=z
  z=0
  if y>=2*t:
    y-=2*t
  else:
    t=t-(y//2)
    y%=2
    if x>=5 and y==1 and t>=1:
      x-=5
      y-=1
      t-=1

    if x<=t*10:
      chk=False
    else:
      x-=t*10
if not chk:
  print("No")
else:
  if z>=n:
    print("Yes")
  else:
    A.sort()
    A=A[:n-z]
    import heapq
    heapq.heapify(A)
    while A:
      a=heapq.heappop(A)
      if a==0:
        aa=1
      else:
        aa=(a-1)//1000+1
      if aa>x+5*y:
        print("No")
        break
      if x>=aa:
        x-=aa
      else:
        y-=1
        if aa>5:
          heapq.heappush(A,a-5000)
      if not A:
        print("Yes")
        break




0