結果

問題 No.1015 おつりは要らないです
ユーザー takakintakakin
提出日時 2020-04-03 22:54:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 19,308 KB
最終ジャッジ日時 2023-09-16 04:02:51
合計ジャッジ時間 5,947 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,200 KB
testcase_01 AC 16 ms
8,248 KB
testcase_02 AC 17 ms
8,380 KB
testcase_03 AC 18 ms
8,268 KB
testcase_04 WA -
testcase_05 AC 17 ms
8,140 KB
testcase_06 AC 17 ms
8,272 KB
testcase_07 AC 17 ms
8,364 KB
testcase_08 AC 16 ms
8,360 KB
testcase_09 AC 16 ms
8,208 KB
testcase_10 AC 195 ms
18,748 KB
testcase_11 AC 206 ms
18,772 KB
testcase_12 AC 191 ms
18,308 KB
testcase_13 AC 199 ms
18,624 KB
testcase_14 AC 203 ms
19,308 KB
testcase_15 AC 193 ms
18,428 KB
testcase_16 AC 203 ms
18,588 KB
testcase_17 AC 207 ms
18,812 KB
testcase_18 AC 194 ms
18,668 KB
testcase_19 AC 193 ms
18,700 KB
testcase_20 AC 164 ms
18,764 KB
testcase_21 AC 159 ms
18,628 KB
testcase_22 AC 164 ms
18,668 KB
testcase_23 AC 156 ms
18,276 KB
testcase_24 AC 168 ms
18,756 KB
testcase_25 AC 158 ms
18,788 KB
testcase_26 AC 164 ms
18,564 KB
testcase_27 AC 157 ms
18,568 KB
testcase_28 AC 154 ms
18,544 KB
testcase_29 AC 156 ms
18,836 KB
testcase_30 AC 17 ms
8,256 KB
testcase_31 AC 114 ms
10,036 KB
testcase_32 AC 113 ms
10,036 KB
testcase_33 AC 81 ms
18,976 KB
testcase_34 AC 17 ms
8,396 KB
testcase_35 AC 17 ms
8,340 KB
testcase_36 AC 16 ms
7,788 KB
権限があれば一括ダウンロードができます

ソースコード

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)
      aa=a//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