結果
問題 |
No.3282 Photos and Friends
|
ユーザー |
|
提出日時 | 2025-09-26 22:59:05 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,006 bytes |
コンパイル時間 | 3,414 ms |
コンパイル使用メモリ | 292,684 KB |
実行使用メモリ | 14,272 KB |
最終ジャッジ日時 | 2025-09-26 22:59:18 |
合計ジャッジ時間 | 11,973 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 WA * 19 RE * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; bool comp(tuple<ll,ll,ll,ll> p,tuple<ll,ll,ll,ll> q){ ll pa,pb,qa,qb; tie(pb,pa,ignore,ignore) = p; tie(qb,qa,ignore,ignore) = q; if(pb != qb)return pb < qb; return pa > pb; } int main(){ ll n,p,q; cin >> n >> p >> q; vector<tuple<ll,ll,ll,ll>> t; for(ll i = 0;i<n;i++){ ll x,a,b; cin >> x >> a >> b; t.emplace_back(b,a,x,i); } vector<pair<ll,ll>> ans(n); sort(t.begin(),t.end(),comp); for(auto tup : t){ auto[b,a,x,i] = tup; ll used = min({x,a,p}); p -= used; x -= used; ans[i].first = used; ll t2; if(0<x){ used = min({x,b,q}); q -= used; x -= used; ans[i].second = used; } if(0<x){ cout << "No\n"; return 0; } } cout << "Yes\n"; for(ll i = 0;i<n;i++)cout << ans[i].first << ' ' << ans[i].second << '\n'; }