欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1613B.Absent Remainder
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.
Input
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 .
Output
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.
Note
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.
Samples
4
2
1 4
4
2 8 3 4
5
3 8 5 9 7
6
2 7 5 3 4 8
4 1
8 2
8 4
9 5
7 5
8 7
4 3
5 2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |