QOJ.ac

QOJ

Limite de temps : 3 s Limite de mémoire : 256 MB Points totaux : 100

#3573. 合资企业

Statistiques

Liesbeth 和 Jan 正在为一门课程项目制作一个机器人,他们发现需要将两块乐高积木放入一个开口中。

开口的宽度为 $x$ 厘米,这两块积木的长度之和必须精确等于开口的宽度,否则机器人在项目演示时会损坏,这将给这两名学生带来灾难性的后果。

照片由 Alan Chia 提供

幸运的是,Liesbeth 和 Jan 在一天深夜潜入物理实验室,非常精确地测量了他们剩余乐高积木的长度。现在,他们只需要挑选出两块能完美填满开口的积木即可。

输入格式

对于每个测试用例,输入包含: 一行包含一个正整数:$x$,表示开口的宽度(单位为厘米),其中 $1 \le x \le 20$。 一行包含一个非负整数:$n$,表示 Liesbeth 和 Jan 可用的乐高积木数量,其中 $0 \le n \le 1000000$。 * $n$ 行,每行包含一个正整数 $\ell$,表示乐高积木的长度(单位为纳米)。Liesbeth 和 Jan 告诉你,没有任何一块乐高积木的长度超过 10 厘米,即 $100000000$ 纳米。

输出格式

对于每个测试用例,如果不存在两块能精确填满开口的乐高积木,则输出一行 danger;如果存在两块长度分别为 $\ell_1$ 和 $\ell_2$ 的积木(满足 $\ell_1 \le \ell_2$),则输出 yes 1 2

如果存在多种解决方案,必须输出使尺寸差 $|\ell_1 - \ell_2|$ 最大的方案。

样例

输入 1

1
4
9999998
1
2
9999999

输出 1

yes 1 9999999

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.