CF1108A.Two distinct points
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given two segments [l1;r1] and [l2;r2] on the x-axis. It is guaranteed that l1<r1 and l2<r2. Segments may intersect, overlap or even coincide with each other.
The example of two segments on the x-axis.
Your problem is to find two integers a and b such that l1≤a≤r1, l2≤b≤r2 and a=b. In other words, you have to choose two distinct integer points in such a way that the first point belongs to the segment [l1;r1] and the second one belongs to the segment [l2;r2].
It is guaranteed that the answer exists. If there are multiple answers, you can print any of them.
You have to answer q independent queries.
给定 x 轴上的两个线段 [l1;r1] 和 [l2;r2]。保证 l1<r1 且 l2<r2。这两个线段可能相交、重叠,甚至完全重合。
x 轴上两个线段的示例。
你的任务是找出两个整数 a 和 b,满足 l1≤a≤r1,l2≤b≤r2,且 a=b。换言之,你需要选择两个互不相同的整数点,使得第一个点位于线段 [l1;r1] 上,第二个点位于线段 [l2;r2] 上。
题目保证答案一定存在。若存在多个可行解,输出任意一个即可。
你需要回答 q 个相互独立的查询。
输入格式
The first line of the input contains one integer q (1≤q≤500) — the number of queries.
Each of the next q lines contains four integers l1i,r1i,l2i and r2i (1≤l1i,r1i,l2i,r2i≤109,l1i<r1i,l2i<r2i) — the ends of the segments in the i-th query.
输入的第一行包含一个整数 q(1≤q≤500),表示查询次数。
接下来的 q 行,每行包含四个整数 l1i,r1i,l2i 和 r2i(1≤l1i,r1i,l2i,r2i≤109,且 l1i<r1i,l2i<r2i),表示第 i 次查询中两个区间的端点。
输出格式
Print 2q integers. For the i-th query print two integers ai and bi — such numbers that l1i≤ai≤r1i, l2i≤bi≤r2i and ai=bi. Queries are numbered in order of the input.
It is guaranteed that the answer exists. If there are multiple answers, you can print any.
输出 2q 个整数。对于第 i 个查询,输出两个整数 ai 和 bi,满足 l1i≤ai≤r1i、l2i≤bi≤r2i,且 ai=bi。查询按输入顺序编号。
保证答案存在。若存在多个答案,输出任意一个即可。
输入输出样例
输入#1
5 1 2 1 2 2 6 3 4 2 4 1 3 1 2 1 3 1 4 5 8
输出#1
2 1 3 4 3 2 1 2 3 7
输入解题思路,AI测评打分。不知道怎么写?