1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #include <iostream> #include <algorithm> using namespace std; int n, k, p, x, y; int main() { cin >> n >> k >> p >> x >> y; int sum = 0; vector<int> a(k); for (int i = 0; i < k; ++i) { cin >> a[i]; sum += a[i]; } x -= sum; if (x < n - k) cout << -1; else { sort(a.begin(), a.end()); int mid = lower_bound(a.begin(), a.end(), y) - a.begin(); int s1 = min(n / 2 - mid, n - k); int s2 = n - s1 - k; if (s1 + s2 * y > x || (s2 && y > p)) { cout << -1; } else { for (int i = 0; i < s1; ++i) { cout << 1 << " "; } for (int i = 0; i < s2; ++i) { cout << y << " "; } } } cout << endl; return 0; }
|