五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1736A - Make A Equal to B

2023-06-23 13:52 作者:您是打尖兒還是住店呢  | 我要投稿

You are given two arrays a and b of n elements, each element is either 0 or 1.

You can make operations of 2 kinds.

Pick an index i and change ai to 1?ai.

Rearrange the array a however you want.

Find the minimum number of operations required to make a equal to b.

Input

Each test contains multiple test cases. The first line contains a single integer t (1≤t≤400) — the number of test cases. Description of the test cases follows.

The first line of each test case contains a single integer n (1≤n≤100) — the length of the arrays a and b.

The second line of each test case contains n space-separated integers a1,a2,…,an (ai is 0 or 1), representing the array a.

The third line of each test case contains n space-separated integers b1,b2,…,bn (bi is 0 or 1), representing the array b.

Output

For each test case, print the minimum number of operations required to make a equal to b.

Example

------------------------------------------------------

中文:

給定兩個包含 n 個元素的數(shù)組 a 和 b,每個元素不是 0 就是 1。

您可以進行 2 種操作。

選擇一個索引 i 并將 ai 更改為 1?ai。

根據(jù)需要重新排列數(shù)組 a。

求使 a 等于 b 所需的最少運算次數(shù)。

輸入

每個測試包含多個測試用例。 第一行包含一個整數(shù) t (1≤t≤400) — 測試用例的數(shù)量。 測試用例的描述如下。

每個測試用例的第一行包含一個整數(shù) n (1≤n≤100) — 數(shù)組 a 和 b 的長度。

每個測試用例的第二行包含n個空格分隔的整數(shù)a1,a2,…,an(ai為0或1),代表數(shù)組a。

每個測試用例的第三行包含n個空格分隔的整數(shù)b1,b2,…,bn(bi為0或1),代表數(shù)組b。

輸出

對于每個測試用例,打印使 a 等于 b 所需的最少操作數(shù)。

例子

就是先判斷2個數(shù)組之間的差異數(shù)量,然后 將2個數(shù)組排序,看差異的數(shù)量+1,2個取最小值即可;

下面是代碼:


CF 1736A - Make A Equal to B的評論 (共 條)

分享到微博請遵守國家法律
永定县| 芒康县| 新兴县| 修文县| 林州市| 昆山市| 开鲁县| 哈密市| 游戏| 崇信县| 河北省| 乌拉特前旗| 鹤岗市| 陈巴尔虎旗| 禹州市| 阳泉市| 油尖旺区| 从化市| 宝坻区| 广饶县| 寻乌县| 安远县| 伊宁县| 青川县| 钟祥市| 隆安县| 苏尼特右旗| 洞口县| 江川县| 离岛区| 澄江县| 朝阳市| 灵丘县| 天镇县| 芦溪县| 周宁县| 东平县| 云阳县| 青田县| 龙泉市| 瑞昌市|