eolymp
bolt
Try our new interface for solving problems
Məsələlər

Work Sheduling

Work Sheduling

There is certain amount of night guards that are available to protect the local junkyard from possible junk robberies. These guards need to scheduled in pairs, so that each pair guards at different night. The junkyard CEO ordered you to write a program which given the guards characteristics determines the maximum amount of scheduled guards (the rest will be fired). Please note that each guard can be scheduled with only one of his colleagues and no guard can work alone. \InputFile The first line of the input contains one number \textbf{N} ≤ \textbf{222} which is the amount of night guards. Unlimited number of lines consisting of unordered pairs (\textbf{i}, \textbf{j}) follow, each such pair means that guard \textbf{i} and guard \textbf{j} can work together, because it is possible to find uniforms that suit both of them (The junkyard uses different parts of uniforms for different guards i.e. helmets, pants, jackets. It is impossible to put small helmet on a guard with a big head or big shoes on guard with small feet). The input ends with Eof. \OutputFile You should output one possible optimal assignment. On the first line of the output write the even number \textbf{C}, the amount of scheduled guards. Then output \textbf{C/2} lines, each containing \textbf{2} integers (\textbf{i}, \textbf{j}) that denote that \textbf{i} and \textbf{j} will work together.
Zaman məhdudiyyəti 2 saniyə
Yaddaşı istafadə məhdudiyyəti 256 MiB
Giriş verilənləri #1
3
1 2
2 3
1 3
Çıxış verilənləri #1
2
1 2