308984: CF1608C. Game Master

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Game Master

题意翻译

### 题目描述 $n$ 个选手正在进行一场比赛。 这场比赛有两个场地。现已明确每个选手在两个场地上的力量值。 有 $n-1$ 场交锋。每次交锋,裁判员从剩余的选手中任选两个,并从两个场地中任选一个。两个选手中,在该场地力量较弱的,会被淘汰。经过 $n-1$ 场交锋后,最终会剩下一位选手,为胜者。 对于每一个选手,判断他是否有机会成为胜者。 本题多测,每个测试点有 $t$ 组数据。 ### 输入格式 第一行一个整数 $t$,表示该测试点数据组数。 对于每组测试数据: 第一行一个整数 $n$,表示选手数量; 第二行 $n$ 个整数 $a_1\dots a_n$,表示每个选手在第一个场地上的力量值。 第三行 $n$ 个整数 $b_1\dots b_n$,表示每个选手在第二个场地上的力量值。 数据保证,对于单组测试数据,$1\leq a_i,b_i\leq 10^9$,$a_i\neq a_j,b_i\neq b_j\forall i\neq j$;对于每个测试点,每组测试数据的 $n$ 之和不超过 $10^5$,且 $t\leq 100$。 ### 输出格式 对于每一组测试数据,输出一行 $0-1$ 串;若对于第 $i$ 个选手,有机会成为胜者则该串第 $i$ 位为 $1$,否则为 $0$。

题目描述

$ 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 \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 $ n $ ( $ 1 \leq n \leq 10^5 $ ) — the number of players. The second line of each test case contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \leq a_i \leq 10^9 $ , $ a_i \neq a_j $ for $ i \neq j $ ), where $ a_i $ is the strength of the $ i $ -th player on the first map. The third line of each test case contains $ n $ integers $ b_1, b_2, \dots, b_n $ ( $ 1 \leq b_i \leq 10^9 $ , $ b_i \neq b_j $ for $ i \neq j $ ), where $ b_i $ 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 $ 10^5 $ .

输出格式


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.

Input

题意翻译

### 题目描述 $n$ 个选手正在进行一场比赛。 这场比赛有两个场地。现已明确每个选手在两个场地上的力量值。 有 $n-1$ 场交锋。每次交锋,裁判员从剩余的选手中任选两个,并从两个场地中任选一个。两个选手中,在该场地力量较弱的,会被淘汰。经过 $n-1$ 场交锋后,最终会剩下一位选手,为胜者。 对于每一个选手,判断他是否有机会成为胜者。 本题多测,每个测试点有 $t$ 组数据。 ### 输入格式 第一行一个整数 $t$,表示该测试点数据组数。 对于每组测试数据: 第一行一个整数 $n$,表示选手数量; 第二行 $n$ 个整数 $a_1\dots a_n$,表示每个选手在第一个场地上的力量值。 第三行 $n$ 个整数 $b_1\dots b_n$,表示每个选手在第二个场地上的力量值。 数据保证,对于单组测试数据,$1\leq a_i,b_i\leq 10^9$,$a_i\neq a_j,b_i\neq b_j\forall i\neq j$;对于每个测试点,每组测试数据的 $n$ 之和不超过 $10^5$,且 $t\leq 100$。 ### 输出格式 对于每一组测试数据,输出一行 $0-1$ 串;若对于第 $i$ 个选手,有机会成为胜者则该串第 $i$ 位为 $1$,否则为 $0$。

加入题单

算法标签: