

Time Limit: 2.5 sec / Memory Limit: 1024 MB
配点 : 点
問題文
座標平面上に から の番号がついた 人の人がいます。
人 は原点にいます。
次の形式の情報が 個与えられます。
- 人 から見て、人 は、 軸正方向に 、 軸正方向に 離れた位置にいる
それぞれの人がいる座標を求めてください。一意に定まらないときはそのことを報告してください。
制約
- 入力は全て整数である
- 与えられる情報は矛盾しない
入力
入力は以下の形式で標準入力から与えられる。
出力
行出力せよ。
人 のいる座標が一意に定まらないとき、 行目には undecidable
と出力せよ。
人 のいる座標が と一意に定まるとき、 行目には をこの順に空白区切りで出力せよ。
入力例 1Copy
3 2 1 2 2 1 1 3 -1 -2
出力例 1Copy
0 0 2 1 -1 -2
人の位置関係は下図のようになっています。
入力例 2Copy
3 2 2 1 -2 -1 2 3 -3 -3
出力例 2Copy
0 0 2 1 -1 -2
人の位置関係は下図のようになっています。
入力例 3Copy
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
出力例 3Copy
0 0 0 0 0 0 undecidable undecidable
同じ情報が複数回与えられたり、同じ座標に複数の人がいることもあります。
Score : points
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 1Copy
3 2 1 2 2 1 1 3 -1 -2
Sample Output 1Copy
0 0 2 1 -1 -2
The figure below shows the positional relationship of the three people.
Sample Input 2Copy
3 2 2 1 -2 -1 2 3 -3 -3
Sample Output 2Copy
0 0 2 1 -1 -2
The figure below shows the positional relationship of the three people.
Sample Input 3Copy
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 3Copy
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.