A12273 | Two distinct points
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You are given two segments $[l_1; r_1]$ and $[l_2; r_2]$ on the $x$ -axis. It is guaranteed that $l_1 < r_1$ and $l_2 < r_2$ . 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 $l_1 \le a \le r_1$ , $l_2 \le b \le r_2$ and $a \ne b$ . In other words, you have to choose two distinct integer points in such a way that the first point belongs to the segment $[l_1; r_1]$ and the second one belongs to the segment $[l_2; r_2]$ .
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.
The example of two segments on the $x$ -axis.Your problem is to find two integers $a$ and $b$ such that $l_1 \le a \le r_1$ , $l_2 \le b \le r_2$ and $a \ne b$ . In other words, you have to choose two distinct integer points in such a way that the first point belongs to the segment $[l_1; r_1]$ and the second one belongs to the segment $[l_2; r_2]$ .
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.
输入格式
The first line of the input contains one integer $q$ ( $1 \le q \le 500$ ) — the number of queries.
Each of the next $q$ lines contains four integers $l_{1_i}, r_{1_i}, l_{2_i}$ and $r_{2_i}$ ( $1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} < r_{1_i}, l_{2_i} < r_{2_i}$ ) — the ends of the segments in the $i$ -th query.
Each of the next $q$ lines contains four integers $l_{1_i}, r_{1_i}, l_{2_i}$ and $r_{2_i}$ ( $1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} < r_{1_i}, l_{2_i} < r_{2_i}$ ) — the ends of the segments in the $i$ -th query.
输出格式
Print $2q$ integers. For the $i$ -th query print two integers $a_i$ and $b_i$ — such numbers that $l_{1_i} \le a_i \le r_{1_i}$ , $l_{2_i} \le b_i \le r_{2_i}$ and $a_i \ne b_i$ . Queries are numbered in order of the input.
It is guaranteed that the answer exists. If there are multiple answers, you can print any.
It is guaranteed that the answer exists. If there are multiple answers, you can print any.
输入输出样例
输入 #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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted