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

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

CF 1631A - Min Max Swap

2023-06-22 12:21 作者:您是打尖兒還是住店呢  | 我要投稿

You are given two arrays a and b of n positive integers each. You can apply the following operation to them any number of times:

Select an index i (1≤i≤n) and swap ai with bi (i. e. ai becomes bi and vice versa).

Find the minimum possible value of ax(a1,a2,…,an)?max(b1,b2,…,bn)

?you can get after applying such operation any number of times (possibly zero).

Input

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

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

The second line of each test case contains n integers a1,a2,…,an (1≤ai≤10000) where ai is the i-th element of the array a.

The third line of each test case contains n integers b1,b2,…,bn (1≤bi≤10000) where bi is the i-th element of the array b.

中文翻譯:

給定兩個(gè)數(shù)組 a 和 b,每個(gè)數(shù)組都有 n 個(gè)正整數(shù)。 您可以對(duì)它們多次應(yīng)用以下操作:


選擇一個(gè)索引 i (1≤i≤n) 并將 ai 與 bi 交換(即 ai 變?yōu)?bi,反之亦然)。

求 ax(a1,a2,…,an)?max(b1,b2,…,bn) 的最小可能值

? 您可以在應(yīng)用此類操作任意次數(shù)(可能為零)后得到。


輸入

輸入由多個(gè)測(cè)試用例組成。 第一行包含一個(gè)整數(shù) t (1≤t≤100) — 測(cè)試用例的數(shù)量。 測(cè)試用例的描述如下。

每個(gè)測(cè)試用例的第一行包含一個(gè)整數(shù) n (1≤n≤100) — 數(shù)組的長(zhǎng)度。

每個(gè)測(cè)試用例的第二行包含n個(gè)整數(shù)a1,a2,…,an

? (1≤ai≤10000) 其中ai是數(shù)組a的第i個(gè)元素。

每個(gè)測(cè)試用例的第三行包含n個(gè)整數(shù)b1,b2,…,bn

? (1≤bi≤10000) 其中bi是數(shù)組b的第i個(gè)元素

.

就是放2個(gè)數(shù)組,一個(gè)數(shù)組存儲(chǔ)a b對(duì)應(yīng)位置較大的值,一個(gè)數(shù)組存儲(chǔ)a b對(duì)應(yīng)位置較小的值。然后依次就去兩個(gè)數(shù)組的最大值,返回他們的乘積即可;

沒什么算法可言,就是純模擬了;


CF 1631A - Min Max Swap的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
和硕县| 托克托县| 即墨市| 遂溪县| 类乌齐县| 大方县| 阿瓦提县| 天津市| 隆化县| 盖州市| 兴国县| 阜宁县| 博野县| 阿克陶县| 灵宝市| 栾川县| 南汇区| 海林市| 长白| 理塘县| 平顶山市| 桦甸市| 乌鲁木齐市| 汶川县| 汶上县| 绥中县| 南华县| 当阳市| 寿阳县| 麻栗坡县| 柘城县| 土默特左旗| 兴隆县| 阳西县| 商都县| 石棉县| 上犹县| 湖北省| 德令哈市| 孟州市| 泾川县|