Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <string>
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <stack>
- #include <queue>
- #include <deque>
- #include <set>
- #include <map>
- #include <cmath>
- #include <unordered_map>
- #include <unordered_set>
- #include <numeric>
- #include <fstream>
- #include <functional>
- #include <iomanip>
- #include <cctype>
- #include <iterator>
- #include <utility>
- #include <bitset>
- #include <tuple>
- #define frt(s, n, t) for(int i = s; (i > n && t < 0) || (i < n && t > 0); i += t)
- #define fr(s, n) for (int i = s; i < n; i++)
- #define frj(s, n) for (int j = 0; j < n; j++)
- #define eol "\n"
- #define pb push_back
- #define ft first
- #define sd second
- using namespace std;
- typedef long long unsigned ull;
- typedef long long ll;
- typedef unordered_map<int, int> umii;
- typedef unordered_set<int> usi;
- typedef unordered_set<ll> usll;
- typedef unordered_set<ull> usull;
- typedef vector<int> vint;
- typedef pair<int, int> pairI;
- typedef pair<string, int> psi;
- typedef vector<pair<int, int>> vpi;
- int main() {
- //ifstream in("input.txt");
- //ofstream out("output.txt");
- ios::sync_with_stdio(0);
- cin.tie(NULL);
- int INF = 1e9;
- int a, b, c, d;
- cin >> a >> b >> c >> d;
- deque<int> start, middle, end;
- int c1 = min(a, b), c2 = min(c, d);
- fr(0, c1) {
- start.push_back(0);
- start.push_back(1);
- b--;
- a--;
- }
- fr(0, c2) {
- end.push_back(2);
- end.push_back(3);
- c--;
- d--;
- }
- if (a == 1) {
- start.push_back(0);
- a--;
- }
- if (d == 1) {
- end.push_front(3);
- d--;
- }
- if (a > 0 || d > 0 || abs(c - b) > 1) {
- cout << "NO";
- exit(0);
- }
- else {
- if (c > b) {
- end.push_back(2);
- c--;
- }
- else if (b > c) {
- start.push_front(1);
- b--;
- }
- fr(0, b) {
- middle.push_back(2);
- middle.push_back(1);
- }
- if ((middle.empty() + start.empty() + end.empty() == 2) || (middle.empty() && abs(start.back()-end.front()) == 1) || (middle.size() && (start.empty() || abs(middle.front() - start.back()) == 1) && (end.empty() || abs(middle.back() - end.front()) == 1))) {
- cout << "YES" << eol;
- for (int x : start) {
- cout << x << " ";
- }
- for (int x : middle) {
- cout << x << " ";
- }
- for (int x : end) {
- cout << x << " ";
- }
- }
- else {
- cout << "NO";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement