結果

問題 No.1015 おつりは要らないです
ユーザー kashibashimin94kashibashimin94
提出日時 2020-04-04 10:54:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,055 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 93,272 KB
最終ジャッジ日時 2023-09-16 05:30:30
合計ジャッジ時間 6,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
71,580 KB
testcase_01 AC 77 ms
71,408 KB
testcase_02 AC 74 ms
71,296 KB
testcase_03 AC 75 ms
71,368 KB
testcase_04 AC 78 ms
71,448 KB
testcase_05 AC 76 ms
71,380 KB
testcase_06 AC 76 ms
71,204 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 125 ms
92,256 KB
testcase_16 AC 127 ms
92,728 KB
testcase_17 AC 128 ms
92,800 KB
testcase_18 AC 125 ms
92,360 KB
testcase_19 AC 126 ms
92,524 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 78 ms
71,536 KB
testcase_31 AC 100 ms
89,276 KB
testcase_32 AC 96 ms
89,272 KB
testcase_33 AC 109 ms
91,996 KB
testcase_34 AC 79 ms
71,564 KB
testcase_35 AC 76 ms
71,416 KB
testcase_36 AC 78 ms
71,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,z,y,x= map(int, input().split())
a= list(map(int, input().split()))

a.sort(reverse=True)

# 1万円以上のものには、1万円を割り当てる
for i in range(n):
    if a[i]//10000>=1 and a[i]//10000<=x:
        x-=a[i]//10000
        a[i]//=10000

    elif a[i]//10000>x:
        a[i]-=10000*x
        x=0
        break
    else:
        break



a.sort(reverse=True)

# 1万円を値段の高いもの順に割り当てる
if x>0:
    # すでに1万円以上はない
    if n<=x:
        print('Yes')
        exit()
    else:
        del a[:x]

#  5000円以上のものに50000円を割り当てる。
n1=len(a)

for i in range(n1):
    if a[i]//5000==0:
        break
    elif a[i]//5000<=y:
        y-=a[i]//5000
        a[i] //= 5000
    else:
        break

# すでに5000円以上はない
if y>0:
    if n1<=y:
        print('Yes')
        exit()
    else:
        del a[:y]

# 1000円以上のものに1000円を割り当てる
n2=len(a)
for i in range(n2):
    z-=a[i]//1000+1


if z>=0:
    print('Yes')
else:
    print('No')
0