結果
問題 |
No.3282 Photos and Friends
|
ユーザー |
👑 |
提出日時 | 2025-09-26 21:50:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 852 bytes |
コンパイル時間 | 263 ms |
コンパイル使用メモリ | 82,104 KB |
実行使用メモリ | 54,316 KB |
最終ジャッジ日時 | 2025-09-26 21:50:59 |
合計ジャッジ時間 | 7,092 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 20 TLE * 1 -- * 29 |
ソースコード
N, P, Q = map(int, input().split()) X, A, B = [], [], [] for _ in range(N): x, a, b = map(int, input().split()) if x > a + b: print("No") exit() X.append(x) A.append(a) B.append(b) ans = [[0] * N for _ in range(2)] for i, (x, a, b) in enumerate(zip(X, A, B)): ans[0][i] = min(x, a) ans[1][i] = x - ans[0][i] if sum(ans[0]) <= P and sum(ans[1]) <= Q: print("Yes") for i in range(N): print(ans[0][i], ans[1][i]) exit() sum_A, sum_B = sum(ans[0]), sum(ans[1]) for i, (x, a, b) in enumerate(zip(X, A, B)): d = min(ans[0][i], b - ans[1][i], sum_A - P) ans[0][i] -= d ans[1][i] += d sum_A -= d sum_B += d if sum(ans[0]) <= P and sum(ans[1]) <= Q: print("Yes") for j in range(N): print(ans[0][j], ans[1][j]) exit() print("No")