Absent Remainder
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Absent Remainder
题面翻译
给你一个长度为 的序列,请找到 个不同的二元组 (两个二元组不同满足 不同或 不同),满足以下性质:
- 和 均在序列中
- 不在序列中
请输出这些二元组。若有多种答案,输出一种即可。
注意: 是向下取整
题目描述
You are given a sequence consisting of pairwise distinct positive integers.
Find different pairs of integers and such that:
- ;
- and appear in ;
- doesn't appear in .
Note that some or can belong to multiple pairs.
denotes the floor function — the largest integer less than or equal to . denotes the remainder from dividing by .
If there are multiple solutions, print any of them. It can be shown that at least one solution always exists.
输入格式
The first line contains a single integer ( ) — the number of testcases.
The first line of each testcase contains a single integer ( ) — the length of the sequence.
The second line of each testcase contains integers ( ).
All numbers in the sequence are pairwise distinct. The sum of over all testcases doesn't exceed .
输出格式
The answer for each testcase should contain different pairs of integers and such that , and appear in and doesn't appear in . Print the pairs one after another.
You can print the pairs in any order. However, the order of numbers in the pair should be exactly such that the first number is and the second number is . All pairs should be pairwise distinct.
If there are multiple solutions, print any of them.
样例 #1
样例输入 #1
4
2
1 4
4
2 8 3 4
5
3 8 5 9 7
6
2 7 5 3 4 8
样例输出 #1
4 1
8 2
8 4
9 5
7 5
8 7
4 3
5 2
提示
In the first testcase there are only two pairs: and . , so we have to find one pair. , and appears in , so that pair is invalid. Thus, the only possible answer is a pair .
In the second testcase, we chose pairs and . doesn't appear in , so that answer is valid. There are multiple possible answers for that testcase.
In the third testcase, the chosen pairs are and . Neither , nor , appears in , so that answer is valid.
20230218排序进阶随堂测验
- Status
- Done
- Rule
- Ledo
- Problem
- 10
- Start at
- 2023-2-18 10:30
- End at
- 2023-2-18 11:30
- Duration
- 1 hour(s)
- Host
- Partic.
- 42