結果
問題 |
No.3023 Utility is Max?
|
ユーザー |
![]() |
提出日時 | 2025-02-14 23:07:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 254 ms |
コンパイル使用メモリ | 82,216 KB |
実行使用メモリ | 78,392 KB |
最終ジャッジ日時 | 2025-02-14 23:07:49 |
合計ジャッジ時間 | 11,148 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 2 |
ソースコード
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 if not f: print("No") continue ama0 = I - A[0] * A[2] - A[1] * A[3] ama1 = I - B[0] * B[2] - B[1] * B[3] if ama0 >= A[0] or ama0 >= A[1] or ama1 >= B[0] or ama1 >= B[1]: print("No") continue a0, b0 = A[:2] a1, b1 = B[:2] if a0 * b1 == a1 * b0: print("Yes") continue if a0 * b1 > a1 * b0: a0, a1, b0, b1 = a1, a0, b1, b0 A, B = B, A if (a1 * b0 - a0 * b1) * A[2] < I * (b0 - b1) and (a1 * b0 - a0 * b1) * B[2] > I * (b0 - b1): print("No") else: print("Yes")