結果
| 問題 | 
                            No.1015 おつりは要らないです
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tachyon777
                         | 
                    
| 提出日時 | 2020-04-03 22:04:34 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,352 bytes | 
| コンパイル時間 | 194 ms | 
| コンパイル使用メモリ | 81,664 KB | 
| 実行使用メモリ | 101,504 KB | 
| 最終ジャッジ日時 | 2024-07-03 02:55:57 | 
| 合計ジャッジ時間 | 4,529 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 16 WA * 17 | 
ソースコード
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,sen,gosen,man = map(int,readline().split())
lst1 = list(map(int,readline().split()))
lst2 = []
lst3 = []
for i in lst1:
    i = i+1
    lst2.append(i//10000)
    lst3.append(i%10000)
#lst2の処理
for i in lst2:
    if i == 0:
        continue
    if i > 0 and man >= 1:
        res = min(man,i)
        man -= res
        i -= res
    
    if i > 0 and gosen >= 1:
        res = min(gosen,i*2)
        gosen -= res
        i -= res
    
    if i > 0 and sen >= 1:
        res = min(sen,i*10)
        sen -= res
        i -= res
    if i > 0:
        print("No")
        exit()
#lst3の処理
#lst3が1000の場合、1000を支払えばよいが、1001の場合は2000必要
lst3.sort(reverse=True)
for i in lst3:
    if i > 0 and man >= 1:
        res = 1
        man -= 1
        i -= res*10000
    
    if i >= 5000 and gosen >= 1:
        res = 1
        gosen -= res
        i -= res*5000
    
    if i > 0 and sen >= 1:
        for j in range(10):
            if i <= j*1000:
                res = j
                break
        if sen >= res:
            sen -= res
            i -= res*1000
    
    if i > 0 and gosen >= 1:
        res = 1
        gosen -= res
        i -= res*5000
    if i > 0:
        print("No")
        exit()
print("Yes")
            
            
            
        
            
tachyon777