hi.2023

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 1t100) — 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 1n,k5) — 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 1bi2023) — 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 2897=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 71717=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;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Pretty Boy Fox

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值