Hockey Match
InterviewTime limit1sMemory limit1024 MB
Given partial hockey statistics for two teams, fill in every value that is uniquely determined by the constraints and leave the rest as -1.
- Level
Medium4 of 10
- Topics
- Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
Malin loves watching ice hockey. Unfortunately, she had far too much homework last night and could not watch the live broadcast of her favorite team's latest match, so now she is curious about what happened during the match.
Usually she goes to Kvällspappret's sports pages to find out, but unfortunately a large part of their website is broken (they need better programmers, as good as PO participants) and only a certain part of the statistics can be read. Malin is mainly interested in three things for each team: the number of goals they scored, the number of shots their goalkeeper saved, and the total number of shots they took at the opponent's goal. Given part of this statistics for each team, reconstruct as much of the statistics as possible.
Input
The first line contains three integers: the number of saves the first team's goalkeeper made, the number of goals scored by the first team, and the number of shots the first team took at the opponent's goal. The second line contains the corresponding information for the second team.
All numbers in the statistics that are known are between and . If a number in the statistics is missing, it is replaced by .
It is guaranteed that there is at least one way to replace all with numbers so that the resulting statistics are correct.
Output
Print the statistics for the two teams in the same format as the input. All missing statistics that can be uniquely determined from the other numbers must be printed instead of . If a certain number cannot be uniquely determined, print .