結果
問題 | No.1015 おつりは要らないです |
ユーザー |
|
提出日時 | 2020-04-11 08:23:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 437 ms / 2,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,824 KB |
最終ジャッジ日時 | 2024-11-18 07:18:19 |
合計ジャッジ時間 | 10,162 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
from heapq import heappush, heappop, heapify N, sen, gosen, man = map(int, input().split()) A = list(map(lambda a: -int(a), input().split())) heapify(A) while A and man > 0: a = -heappop(A) c = max(1, min(man, a // 10000)) a -= c * 10000 man -= c if a >= 0: heappush(A, -a) while A and gosen > 0: a = -heappop(A) c = max(1, min(gosen, a // 5000)) a -= c * 5000 gosen -= c if a >= 0: heappush(A, -a) A = [-a for a in A] cnt = 0 for a in A: c = -(-a // 1000) if c * 1000 == a: c += 1 cnt += c print('Yes' if cnt <= sen else 'No')