Codeforces-SolutionsA/Codes/1845 A - Forbidden Integer/1845A.cpp
2023-12-31 14:54:40 +06:00

49 lines
933 B
C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n, k, x;
cin >> n >> k >> x;
if (k == 1)
cout << "NO" << endl;
else if (x != 1)
{
cout << "YES" << endl;
cout << n << endl;
for (int i = 0; i < n; i++)
cout << 1 << " ";
cout << endl;
}
else if (n % 2 == 0)
{
cout << "YES" << endl;
cout << n/2 << endl;
for (int i = 0; i < n / 2; i++)
cout << 2 << " ";
cout << endl;
}
else if (k == 2)
cout << "NO" << endl;
else
{
cout << "YES" << endl;
cout << n/2 << endl;
for (int i = 0; i < n / 2 - 1; i++)
cout << 2 << " ";
cout << 3 << endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
cin >> TC;
cin.ignore();
while (TC--)
solve();
}