結果
| 問題 |
No.842 初詣
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-28 00:13:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 782 bytes |
| コンパイル時間 | 173 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 87,168 KB |
| 最終ジャッジ日時 | 2024-09-25 03:18:01 |
| 合計ジャッジ時間 | 3,780 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 17 |
ソースコード
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################
A, B, C, D, E, F, G = map(int, input().split())
def dfs(a, b, c, d, e, f, g):
if g <= 0:
return g == 0
if a > 0:
if dfs(a-1, b, c, d, e, f, g-500*a): return True
if b > 0:
if dfs(a, b-1, c, d, e, f, g-100*b): return True
if c > 0:
if dfs(a, b, c-1, d, e, f, g-50*c): return True
if d > 0:
if dfs(a, b, c, d-1, e, f, g-10*d): return True
if e > 0:
if dfs(a, b, c, d, e-1, f, g-5*e): return True
if f > 0:
if dfs(a, b, c, d, e, f-1, g-1*f): return True
return False
print('YES' if dfs(A, B, C, D, E, F, G) else 'NO')