A13210 | Cartoons
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The first line contains single integer $t$ ( $1 \le t \le 1000$ ) — the number of test cases. The following are descriptions of the $t$ test cases.
The first line of each test case contains a single integer $n$ ( $1 \le n \le 2000$ ) — the number of cartoons.
In the next $n$ lines, the cartoons themselves are described, one per line, by a pair of integers $a_i$ , $b_i$ ( $1 \le a_i \le b_i \le 10^9$ ) — the first and last airing days for the $i$ -th cartoon.
It is guaranteed that the sum of the values $n$ for all test cases in the input does not exceed $2000$ .
The first line of each test case contains a single integer $n$ ( $1 \le n \le 2000$ ) — the number of cartoons.
In the next $n$ lines, the cartoons themselves are described, one per line, by a pair of integers $a_i$ , $b_i$ ( $1 \le a_i \le b_i \le 10^9$ ) — the first and last airing days for the $i$ -th cartoon.
It is guaranteed that the sum of the values $n$ for all test cases in the input does not exceed $2000$ .
输入格式
Print $t$ answers to given test cases in the order in which they appear in the input: the $i$ -th answer is such $x$ , that only one cartoon will be airing on day $x$ or -1 if there are no such days.
输出格式
In the third test case: at day $1$ and $2$ , first and third cartoons will be airing, and days $3$ and $4$ , second and third cartoons will be airing. So, there is no day when only one cartoon will be airing.
In the fourth test case, $11$ is also a possible answer.
In the fourth test case, $11$ is also a possible answer.
输入输出样例
输入 #1
5 1 1 1 3 2 1000000000 2 500000000 500000002 1000000000 3 1 2 3 4 1 4 2 4 11 4 9 3 1 5 10 10 1 5
输出 #1
1 500000001 -1 10 10
In the third test case: at day $1$ and $2$ , first and third cartoons will be airing, and days $3$ and $4$ , second and third cartoons will be airing. So, there is no day when only one cartoon will be airing.
In the fourth test case, $11$ is also a possible answer.
In the fourth test case, $11$ is also a possible answer.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted