結果
| 問題 |
No.3282 Photos and Friends
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-26 22:03:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 771 bytes |
| コンパイル時間 | 1,940 ms |
| コンパイル使用メモリ | 198,020 KB |
| 実行使用メモリ | 7,808 KB |
| 最終ジャッジ日時 | 2025-09-26 22:03:19 |
| 合計ジャッジ時間 | 8,462 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 13 WA * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
int N;
cin >> N;
ll P, Q;
cin >> P >> Q;
std::vector<ll> L(N), R(N), X(N);
for (int i = 0; i < N; i ++) {
ll a, b, x;
cin >> a >> b >> x;
X[i] = x;
if (a + b < x) {
puts("No");
return 0;
}
L[i] = max(0ll, x - b);
R[i] = min(a, x);
}
ll sx = accumulate(X.begin(), X.end(), 0ll);
if (P + Q < sx) {
puts("No");
return 0;
}
ll Pl = max(0ll, sx - Q);
ll sl = accumulate(L.begin(), L.end(), 0ll), sr = accumulate(R.begin(), R.end(), 0ll);
if (sr < Pl || P < sl) {
puts("No");
return 0;
}
puts("Yes");
P -= sl;
for (int i = 0; i < N; i ++) {
ll a = L[i];
ll d = min(P, R[i] - L[i]);
cout << a + d << " " << (X[i] - a - d) << endl;
P -= d;
}
}