結果

問題 No.3023 Utility is Max?
ユーザー kidodesu
提出日時 2025-02-14 21:35:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,776 KB
実行使用メモリ 78,560 KB
最終ジャッジ日時 2025-02-14 21:36:22
合計ジャッジ時間 10,856 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

q = int(input())
for _ in range(q):
    I = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    f = True
    if A[0] * A[2] + A[1] * A[3] > I:
        f = False
    if B[0] * B[2] + B[1] * B[3] > I:
        f = False
    ama0 = I - A[0] * A[2] - A[1] * A[3]
    ama1 = I - B[0] * B[2] - B[1] * B[3]
    ama2 = I - A[0] * B[2] - A[1] * B[3]
    ama3 = I - B[0] * A[2] - B[1] * A[3]
    if ama0 >= A[0] or ama0 >= A[1]:
        f = False
    if ama2 >= A[0] or ama2 >= A[1]:
        f = False
    if ama1 >= B[0] or ama1 >= B[1]:
        f = False
    if ama3 >= B[0] or ama3 >= B[1]:
        f = False
    if f:
        print("Yes")
    else:
        print("No")
0