CF1608C.Game Master
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
n 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 n−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 t ( 1≤t≤100 ) — the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer n ( 1≤n≤105 ) — the number of players.
The second line of each test case contains n integers a1,a2,…,an ( 1≤ai≤109 , ai=aj for i=j ), where ai is the strength of the i -th player on the first map.
The third line of each test case contains n integers b1,b2,…,bn ( 1≤bi≤109 , bi=bj for i=j ), where bi is the strength of the i -th player on the second map.
It is guaranteed that the sum of n over all test cases does not exceed 105 .
输出格式
For each test case print a string of length n . i -th character should be "1" if the i -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 4 -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.