CF1916A.2023

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In a sequence aa, whose product was equal to 20232023, kk numbers were removed, leaving a sequence bb of length nn. Given the resulting sequence bb, find any suitable sequence aa and output which kk 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.

在一个序列 aa 中,其所有元素的乘积等于 20232023,从中移除了 kk 个数,得到一个长度为 nn 的序列 bb。已知所得序列 bb,请找出任意一个满足条件的原序列 aa,并输出从 aa 中移除的 kk 个元素;若不存在这样的序列,则说明其不可能存在。

注意:不能保证这样的数组一定存在。

输入格式

Each test consists of several test cases. The first line contains a single integer tt (1≤t≤1001 \le t \le 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 nn (1≤n,k≤51 \le n, k \le 5) — the size of sequence bb and the number of numbers removed from sequence aa.

The second line contains nn integers b1,b2,…,bnb_1,b_2, \ldots,b_n (1≤bi≤20231 \leq b_i \leq 2023) — the remaining sequence. The values of bib_i might not be divisors of 20232023.

每个测试包含若干个测试用例。第一行包含一个整数 tt(1≤t≤1001 \le t \le 100),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含两个整数 nn 和 kk(1≤n,k≤51 \le n, k \le 5),分别表示序列 bb 的长度以及从序列 aa 中移除的数字个数。

每个测试用例的第二行包含 nn 个整数 b1,b2,…,bnb_1,b_2, \ldots,b_n(1≤bi≤20231 \leq b_i \leq 2023),即剩余的序列。注意:bib_i 的值未必是 20232023 的因数。

输出格式

For each test case, output "YES" if the sequence aa exists, and in the following line output kk non-negative integers that were removed from the sequence aa. If the sequence aa 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.

对于每个测试用例,如果序列 aa 存在,则输出 "YES";并在下一行输出从序列 aa 中移除的 kk 个非负整数。如果序列 aa 不存在,则在单独一行中输出 "NO"。

你可以以任意大小写形式输出答案(大写或小写均可)。例如,字符串 "yEs"、"yes"、"Yes" 和 "YES" 均会被识别为肯定回答。

输入输出样例

  • 输入#1

    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

    输出#1

    NO
    NO
    YES
    7 1
    YES
    1
    YES
    7
    YES
    1
    YES
    7 17 17

说明/提示

In third test case product is equal to 289⋅7=2023289 \cdot 7 = 2023.

In fourth test case product is already equal to 20232023.

In seventh test case product is equal to 7⋅17⋅17=20237 \cdot 17 \cdot 17 = 2023.

在第三个测试用例中,乘积等于 289⋅7=2023289 \cdot 7 = 2023。

在第四个测试用例中,乘积已经等于 20232023。

在第七个测试用例中,乘积等于 7⋅17⋅17=20237 \cdot 17 \cdot 17 = 2023。

输入解题思路,AI测评打分。不知道怎么写?

首页