제출 #710983

#제출 시각아이디문제언어결과실행 시간메모리
710983YeoBLRainy Markets (CCO22_day1problem2)C++14
5 / 25
474 ms72308 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define mp make_pair #define pb emplace_back int32_t main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int p[n - 1], b[n], u[n - 1]; pair <int, pair <int, int> > ans[n - 1]; for (int i = 0; i < n; i++) cin >> b[i]; for (int i = 0; i < n - 1; i++) cin >> p[i]; for (int i = 0; i < n - 1; i++) cin >> u[i]; bool poss = true; for (int i = n - 2; i >= 0; i--){ ans[i].se.se = min(b[i + 1], p[i]); b[i + 1] -= ans[i].se.se; p[i] -= ans[i].se.se; ans[i].se.fi = 0; ans[i].fi = min(b[i], p[i]); b[i] -= ans[i].fi; p[i] -= ans[i].fi; if (p[i] > 0) poss = false; } if (poss){ cout << "YES\n0\n"; for (int i = 0; i < n - 1; i++){ cout << ans[i].fi << ' ' << ans[i].se.fi << ' ' << ans[i].se.se << '\n'; } } else cout << "NO\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...