CF1608C.Game Master

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

nn players are playing a game.

There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map.

You are the game master and want to organize a tournament. There will be a total of n1n-1 battles. While there is more than one player in the tournament, choose any map and any two remaining players to fight on it. The player who loses will be eliminated from the tournament.

In the end, exactly one player will remain, and he is declared the winner of the tournament. For each player determine if he can win the tournament.

输入格式

The first line contains a single integer tt ( 1t1001 \le t \le 100 ) — the number of test cases. The description of test cases follows.

The first line of each test case contains a single integer nn ( 1n1051 \leq n \leq 10^5 ) — the number of players.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \dots, a_n ( 1ai1091 \leq a_i \leq 10^9 , aiaja_i \neq a_j for iji \neq j ), where aia_i is the strength of the ii -th player on the first map.

The third line of each test case contains nn integers b1,b2,,bnb_1, b_2, \dots, b_n ( 1bi1091 \leq b_i \leq 10^9 , bibjb_i \neq b_j for iji \neq j ), where bib_i is the strength of the ii -th player on the second map.

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

输出格式

For each test case print a string of length nn . ii -th character should be "1" if the ii -th player can win the tournament, or "0" otherwise.

输入输出样例

  • 输入#1

    3
    4
    1 2 3 4
    1 2 3 4
    4
    11 12 20 21
    44 22 11 30
    1
    1000000000
    1000000000

    输出#1

    0001
    1111
    1

说明/提示

In the first test case, the 44 -th player will beat any other player on any game, so he will definitely win the tournament.

In the second test case, everyone can be a winner.

In the third test case, there is only one player. Clearly, he will win the tournament.

首页