#abc320d. D - Relative Position
D - Relative Position
Score : points
问题描述
在坐标平面上有 名编号为 至 的人。
第 号人在原点。
给定 条如下形式的信息:
- 从第 号人的视角看,第 号人在正 轴方向上距离为 单位,在正 轴方向上距离为 单位。
请确定每个人所在的坐标。如果某个人的坐标无法唯一确定,请报告这一事实。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are people numbered to on a coordinate plane.
Person is at the origin.
You are given pieces of information in the following form:
- From person 's perspective, person is units away in the positive -direction and units away in the positive -direction.
Determine the coordinates of each person. If the coordinates of a person cannot be uniquely determined, report that fact.
Constraints
- All input values are integers.
- The given information is consistent.
Input
The input is given from Standard Input in the following format:
Output
Print lines.
If the coordinates of person cannot be uniquely determined, the -th line should contain undecidable
.
If they can be uniquely determined as , the -th line should contain and in this order, separated by a space.
Sample Input 1
3 2
1 2 2 1
1 3 -1 -2
Sample Output 1
0 0
2 1
-1 -2
The figure below shows the positional relationship of the three people.
Sample Input 2
3 2
2 1 -2 -1
2 3 -3 -3
Sample Output 2
0 0
2 1
-1 -2
The figure below shows the positional relationship of the three people.
Sample Input 3
5 7
1 2 0 0
1 2 0 0
2 3 0 0
3 1 0 0
2 1 0 0
3 2 0 0
4 5 0 0
Sample Output 3
0 0
0 0
0 0
undecidable
undecidable
The same piece of information may be given multiple times, and multiple people may be at the same coordinates.
update @ 2024/3/10 01:38:41