結果

問題 No.1015 おつりは要らないです
ユーザー ゼットゼット
提出日時 2023-10-08 19:49:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 843 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 92,036 KB
最終ジャッジ日時 2023-10-08 19:49:54
合計ジャッジ時間 5,222 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,392 KB
testcase_01 AC 65 ms
71,464 KB
testcase_02 AC 66 ms
71,372 KB
testcase_03 AC 65 ms
71,584 KB
testcase_04 AC 64 ms
71,448 KB
testcase_05 AC 66 ms
71,296 KB
testcase_06 AC 74 ms
71,348 KB
testcase_07 AC 65 ms
71,196 KB
testcase_08 AC 65 ms
71,444 KB
testcase_09 AC 65 ms
71,252 KB
testcase_10 AC 99 ms
91,452 KB
testcase_11 AC 98 ms
91,508 KB
testcase_12 AC 97 ms
91,428 KB
testcase_13 AC 98 ms
91,456 KB
testcase_14 AC 99 ms
91,592 KB
testcase_15 AC 98 ms
91,340 KB
testcase_16 AC 98 ms
91,404 KB
testcase_17 AC 104 ms
91,612 KB
testcase_18 AC 102 ms
91,400 KB
testcase_19 AC 104 ms
91,400 KB
testcase_20 AC 96 ms
91,124 KB
testcase_21 AC 89 ms
91,100 KB
testcase_22 AC 89 ms
91,072 KB
testcase_23 AC 90 ms
91,268 KB
testcase_24 AC 88 ms
91,136 KB
testcase_25 AC 89 ms
91,128 KB
testcase_26 AC 91 ms
91,036 KB
testcase_27 AC 94 ms
90,904 KB
testcase_28 AC 98 ms
91,208 KB
testcase_29 AC 90 ms
91,356 KB
testcase_30 AC 66 ms
71,404 KB
testcase_31 AC 84 ms
89,336 KB
testcase_32 AC 84 ms
89,432 KB
testcase_33 AC 94 ms
92,036 KB
testcase_34 AC 66 ms
71,516 KB
testcase_35 AC 66 ms
71,468 KB
testcase_36 AC 67 ms
71,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,x,y,z=map(int,input().split())
A=list(map(int,input().split()))
v=[0]*10
for i in range(N):
  n=A[i]
  n+=1000
  h=n//(10000)
  if z>=h:
    z-=h
  else:
    h-=z
    z=0
    if y>=2*h:
      y-=2*h
    else:
      cost=10000*h
      cost-=5000*y
      y=0
      if 1000*x>=cost:
        x-=cost//(1000)
      else:
        print('No')
        exit()
  t=(A[i]+1000)%(10000)
  v[t//(1000)]+=1
for i in range(9,0,-1):
  if z>=v[i]:
    z-=v[i]
    v[i]=0
  else:
    v[i]-=z
    z=0
for i in range(9,0,-1):
  if y>=v[i]:
    if i>=5:
      v[i-5]+=v[i]
      y-=v[i]
      v[i]=0
    else:
      y-=v[i]
      v[i]=0
  else:
    if i>=5:
      v[i-5]+=y
      v[i]-=y
      y=0
    else:
      v[i]-=y
      y=0
for i in range(9,0,-1):
  if x>=i*v[i]:
    x-=i*v[i]
    v[i]=0
v[0]=0
if sum(v)==0:
  print('Yes')
else:
  print('No')
  
      
0