P7026 [NWRRC 2017] Hidden Supervisors
Description
Helena works in a big company as a psychologist. Her task is to organize a team building game to enhance social relations between employees. Each employee except the Big boss has a single supervisor. So, employees of the company form a tree where each employee is a node, and the parent of that node is their supervisor. The root of the tree is the Big boss.
A team building game requires teams of two people. Every team should consist of an employee and their supervisor.
Helena asked every employee except the Big boss to send their supervisor ID. Some of them didn't reply. She is going to assign a fake supervisor to every employee that didn't reply, so that she could arrange as many teams as possible. And, of course, fake and real supervisors must form a tree.
Helena had a difficult, but a successful day organizing the event. Will you be able to assign fake supervisors?
Input Format
N/A
Output Format
N/A
Explanation/Hint
Time limit: 3 s, Memory limit: 512 MB.