結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-03 21:45:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 1,346 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 82,300 KB |
| 実行使用メモリ | 83,296 KB |
| 最終ジャッジ日時 | 2024-11-17 23:07:47 |
| 合計ジャッジ時間 | 3,824 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10 ** 10
MOD = 10 ** 9 + 7
from heapq import heapify,heappop,heappush
input = sys.stdin.readline
from bisect import bisect_left
def to(n):
return (n//1000 + 1) * 1000
def main():
n,x,y,z = map(int,input().split())
a = [to(int(i)) for i in input().split()]
a.sort(reverse = True)
for i in range(n):
if z == 0:
break
if a[i] > 10000:
if a[i]//10000 <= z:
z -= a[i]//10000
a[i] %= 10000
else:
a[i] -= z * 10000
z = 0
if z > 0:
a.sort(reverse = True)
for i in range(min(z,n)):
a[i] = 0
a.sort(reverse = True)
for i in range(n):
if y == 0:
break
if a[i] > 5000:
if a[i]//5000 <= y:
y -= a[i]//5000
a[i] %= 5000
else:
a[i] -= y * 5000
y = 0
if y > 0:
a.sort(reverse = True)
for i in range(min(y,n)):
a[i] = 0
for i in range(n):
if a[i] > 0:
x -= (a[i] + 999)//1000
if x < 0:
print('No')
else:
print('Yes')
if __name__ == '__main__':
main()