QOJ.ac

QOJ

حد الوقت: 3.0 s حد الذاكرة: 512 MB مجموع النقاط: 100

#8621. 背包问题

الإحصائيات

$n = 10^4$ 个整数 $a_1, a_2, \dots, a_n$ 是从范围 $[1, 10^{12}]$ 中随机且独立生成的。

对于每个整数,你需要将其丢弃,或者将其放入集合 $A$、$B$ 或 $C$ 中的一个。集合 $A$ 中整数的和应等于集合 $B$ 中整数的和,且等于集合 $C$ 中整数的和。

每个集合至少应包含一个整数。如果存在多种解,你可以输出其中任意一个。题目保证系统中的所有测试数据均存在解。

输入格式

第一行包含一个整数 $n$ ($n = 10^4$ 或 $n = 6$),表示数组中元素的个数。

第二行包含整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^{12}$)。

除样例外,所有测试数据均保证 $n = 10^4$,且整数 $a_i$ 是从均匀分布中随机生成的。

输出格式

输出一行,包含 $n$ 个字符。对于每个整数,如果你想丢弃它,请输出 “.”。否则,输出 “A”、“B” 或 “C” 以表示将该整数放入对应的集合。

样例

样例输入 1

6
4 3 8 1 5 4

样例输出 1

ABC.BA

说明

本题包含一个样例测试和 50 个真实测试用例。

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.