B. 2023
Problem
In a sequence a a a, whose product was equal to 2023 2023 2023, k k k numbers were removed, leaving a sequence b b b of length n n n. Given the resulting sequence b b b, find any suitable sequence a a a and output which k k k elements were removed from it, or state that such a sequence could not have existed.
Notice that you are not guaranteed that such array exists.
Input
Each test consists of several test cases. The first line contains a single integer t t t ( 1 ≤ t ≤ 100 1 \le t \le 100 1≤t≤100) — the number of test cases. This is followed by a description of the test cases.
The first line of each test case contains two integers n n n ( 1 ≤ n , k ≤ 5 1 \le n, k \le 5 1≤n,k≤5) — the size of sequence b b b and the number of numbers removed from sequence a a a.
The second line contains n n n integers b 1 , b 2 , … , b n b_1,b_2, \ldots,b_n b1,b2,…,bn ( 1 ≤ b i ≤ 2023 1 \leq b_i \leq 2023 1≤bi≤2023) — the remaining sequence. The values of b i b_i bi might not be divisors of 2023 2023 2023.
Output
For each test case, output “YES” if the sequence a a a exists, and in the following line output k k k non-negative integers that were removed from the sequence a a a. If the sequence a a a does not exist, output “NO” in a single line.
You can output the answer in any case (uppercase or lowercase). For example, the strings “yEs”, “yes”, “Yes”, and “YES” will be recognized as positive answers.
Example
Input
7
2 2
5 2
3 1
7 17 7
4 2
1 289 1 1
3 1
7 17 17
1 1
289
1 1
2023
1 3
1
Output
NO
NO
YES
7 1
YES
1
YES
7
YES
1
YES
7 17 17
Note
In third test case product is equal to 289 ⋅ 7 = 2023 289 \cdot 7 = 2023 289⋅7=2023.
In fourth test case product is already equal to 2023 2023 2023.
In seventh test case product is equal to 7 ⋅ 17 ⋅ 17 = 2023 7 \cdot 17 \cdot 17 = 2023 7⋅17⋅17=2023.
Code
// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <stack>//栈
// #include <deque>//堆/优先队列
// #include <queue>//队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
ll n,k;
cin>>n>>k;
ll sum=1;
while(n--)
{
ll x;
cin>>x;
sum*=x;
}
if(2023%sum!=0) cout<<"NO"<<endl;
else
{
cout<<"YES"<<endl;
cout<<2023/sum;
while(--k) cout<<" "<<1;
cout<<endl;
}
}
int main()
{
ll t;
cin>>t;
while(t--) solve();
return 0;
}