A11743 | Guard Duty (easy)
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign $R$ Rebel spaceships to guard $B$ bases so that every base has exactly one guardian and each spaceship has exactly one assigned base (in other words, the assignment is a perfect matching). Since she knows how reckless her pilots are, she wants to be sure that any two (straight) paths – from a base to its assigned spaceship – do not intersect in the galaxy plane (that is, in 2D), and so there is no risk of collision.
输入格式
The first line contains two space-separated integers $R,B(1<=R,B<=10)$ . For $1<=i<=R$ , the $i+1$ -th line contains two space-separated integers $x_{i}$ and $y_{i}$ ( $|x_{i}|,|y_{i}|<=10000$ ) denoting the coordinates of the $i$ -th Rebel spaceship. The following $B$ lines have the same format, denoting the position of bases. It is guaranteed that no two points coincide and that no three points are on the same line.
输出格式
If it is possible to connect Rebel spaceships and bases so as satisfy the constraint, output Yes, otherwise output No (without quote).
输入输出样例
输入 #1
3 3 0 0 2 0 3 1 -2 1 0 3 2 2
输出 #1
Yes
输入 #2
2 1 1 0 2 2 3 1
输出 #2
No
For the first example, one possible way is to connect the Rebels and bases in order.
For the second example, there is no perfect matching between Rebels and bases.
For the second example, there is no perfect matching between Rebels and bases.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted