結果
問題 |
No.3282 Photos and Friends
|
ユーザー |
|
提出日時 | 2025-09-27 00:44:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,506 bytes |
コンパイル時間 | 2,521 ms |
コンパイル使用メモリ | 222,548 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2025-09-27 00:44:35 |
合計ジャッジ時間 | 10,769 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 33 WA * 17 |
ソースコード
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<n;i++) #define srep(i,l,r) for(ll i=l;i<=r;i++) #define irep(i,r,l) for(ll i=r;i>=l;i--) using ll = long long; using ld = long double; const ll mod=998244353; #define vout(v) for(auto i :v) cout<<i<<" "; #define INF 9223300000000000000ll #define Winf 5e12 #define nl "\n" #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define vl vector<ll> #define pb push_back #define vc vector<char> #define vb vector<bool> #define uniq(x) sort((x).begin(),(x).end());(x).erase(unique((x).begin(),(x).end()),(x).end()) #define eb emplace_back void no(void) { cout<<"No"<<nl;} void yes(void) {cout<<"Yes"<<nl;} void yn(bool a) { cout<<(a ? "Yes":"No")<<nl; } vector<ll> dx={-1,0,1,0,1,1,-1,-1}; vector<ll> dy={0,-1,0,1,-1,1,-1,1}; bool isin(ll i,ll j,ll h,ll w) { if(i<0 || i>=h || j<0 || j>=w) return false; return true; } template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} template<class T>T vecmax(const vector<T>&v){return *max_element(all(v));} template<class T>T vecmin(const vector<T>&v){return *min_element(all(v));} ll safemod(ll num,ll rule) { return (num%rule+rule)%rule; } ll sum(vector<ll> &a) { return accumulate(all(a),0); } template<class T>void vvpr(vector<vector<T>> g) { rep(i,g.size()) { rep(j,g[i].size()) { cout<<g[i][j]<<(j==g[i].size()-1 ? "\n":" "); } } } //ファイル読み込みは第二フォルダから ex:include "mathtype/hoge.hpp" int main() { ll n,p,q; cin>>n>>p>>q; vl ans1(n),ans2(n); vl x(n),a(n),b(n); rep(i,n) cin>>x[i]>>a[i]>>b[i]; rep(i,n) { if(x[i]>a[i]+b[i]) { no(); return 0; } } if(accumulate(all(x),0ll)>p+q) { no(); return 0; } ll sumxb=0; rep(i,n) sumxb+=max(x[i]-b[i],0ll); if(sumxb<=p && accumulate(all(x),0ll)-q<=accumulate(all(a),0ll)) { rep(i,n) ans1[i]=max(0ll,x[i]-b[i]); rep(i,n) p-=max(0ll,x[i]-b[i]); rep(i,n) { ll qq=min(p,a[i]-ans1[i]); ans1[i]+=qq; p-=qq; } if(sum(ans1)<sum(x)-q) {no(); return 0; } yes(); rep(i,n) ans2[i]=x[i]-ans1[i]; rep(i,n) cout<<ans1[i]<<" "<<ans2[i]<<nl; } else no(); }