CF1707A.Doremy's IQ

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Doremy is asked to test nn contests. Contest ii can only be tested on day ii. The difficulty of contest ii is aia_i. Initially, Doremy's IQ is qq. On day ii Doremy will choose whether to test contest ii or not. She can only test a contest if her current IQ is strictly greater than 00.

If Doremy chooses to test contest ii on day ii, the following happens:

  • if ai>qa_i \gt q, Doremy will feel she is not wise enough, so qq decreases by 11;
  • otherwise, nothing changes.

If she chooses not to test a contest, nothing changes.

Doremy wants to test as many contests as possible. Please give Doremy a solution.

Doremy 被要求测试 nn 场比赛。比赛 ii 只能在第 ii 天进行测试。比赛 ii 的难度为 aia_i。初始时,Doremy 的智商为 qq。在第 ii 天,Doremy 需决定是否测试比赛 ii。她仅当当前智商严格大于 00 时,才可测试某场比赛。

若 Doremy 在第 ii 天选择测试比赛 ii,则发生以下情况:

  • 若 ai>qa_i \gt q,Doremy 会感到自己不够聪慧,因此 qq 减少 11;
  • 否则,qq 不发生变化。

若她选择不测试某场比赛,则一切保持不变。

Doremy 希望尽可能多地测试比赛。请为 Doremy 给出一个方案。

输入格式

The input consists of multiple test cases. The first line contains a single integer tt (1≤t≤1041\le t\le 10^4) — the number of test cases. The description of the test cases follows.

The first line contains two integers nn and qq (1≤n≤1051 \le n \le 10^5, 1≤q≤1091 \le q \le 10^9) — the number of contests and Doremy's IQ in the beginning.

The second line contains nn integers a1,a2,⋯ ,ana_1,a_2,\cdots,a_n (1≤ai≤1091 \le a_i \le 10^9) — the difficulty of each contest.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

输入包含多个测试用例。第一行包含一个整数 tt(1≤t≤1041\le t\le 10^4),表示测试用例的数量。随后是各测试用例的描述。

第一行包含两个整数 nn 和 qq(1≤n≤1051 \le n \le 10^5,1≤q≤1091 \le q \le 10^9),分别表示比赛的数量以及 Doremy 初始的智商值。

第二行包含 nn 个整数 a1,a2,⋯ ,ana_1,a_2,\cdots,a_n(1≤ai≤1091 \le a_i \le 10^9),表示每场比赛的难度。

保证所有测试用例中 nn 的总和不超过 10510^5。

输出格式

For each test case, you need to output a binary string ss, where si=1s_i=1 if Doremy should choose to test contest ii, and si=0s_i=0 otherwise. The number of ones in the string should be maximum possible, and she should never test a contest when her IQ is zero or less.

If there are multiple solutions, you may output any.

对于每个测试用例,你需要输出一个二进制字符串 ss,其中若 Doremy 应当选择测试第 ii 场比赛,则 si=1s_i=1;否则 si=0s_i=0。该字符串中 1 的个数应尽可能多,且她绝不能在 IQ 为零或负数时测试任何比赛。

若存在多个解,你可以输出任意一个。

输入输出样例

  • 输入#1

    5
    1 1
    1
    2 1
    1 2
    3 1
    1 2 1
    4 2
    1 4 3 1
    5 2
    5 1 2 4 3

    输出#1

    1
    11
    110
    1110
    01111

说明/提示

In the first test case, Doremy tests the only contest. Her IQ doesn't decrease.

In the second test case, Doremy tests both contests. Her IQ decreases by 11 after testing contest 22.

In the third test case, Doremy tests contest 11 and 22. Her IQ decreases to 00 after testing contest 22, so she can't test contest 33.

在第一个测试用例中,Doremy 参加唯一的一场竞赛。她的智商不会下降。

在第二个测试用例中,Doremy 参加两场竞赛。她在参加竞赛 22 后智商下降 11。

在第三个测试用例中,Doremy 参加竞赛 11 和 22。她在参加竞赛 22 后智商降至 00,因此无法参加竞赛 33。

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

首页