24 hour archive: Problem
2378  Joint Venture 2378  Joint Venture 2378  Joint Venture
Statistics  Sub: 1164  AC: 270  AC%: 23,20  Score: 1,38 
Created by  2012 NWERC 
Added by  jmargilagos (20130508) 
Limits 
Total Time: 45000 MS
Memory: 256 MB  Output: 64 MB  Size:
16 KB

Enabled languages  
Available in 
Description
Liesbeth and Jan are building a robot for a course project and have discovered that they need to fit two pieces of Lego into an opening.
The opening is x centimetres wide and the sum of the lengths of the two pieces has to be precisely equal to the width of the opening, or else the robot will break during the project demonstration, with catastrophic consequences for the grades of the two students.
Luckily, Liesbeth and Jan were able to sneak into the physics laboratory late one night to measure the lengths of their remaining Lego pieces very accurately. Now they just need to select two pieces that will fit the opening perfectly.
Liesbeth and Jan are building a robot for a course project and have discovered that they need to fit two pieces of Lego into an opening.
The opening is x centimetres wide and the sum of the lengths of the two pieces has to be precisely equal to the width of the opening, or else the robot will break during the project demonstration, with catastrophic consequences for the grades of the two students.
Luckily, Liesbeth and Jan were able to sneak into the physics laboratory late one night to measure the lengths of their remaining Lego pieces very accurately. Now they just need to select two pieces that will fit the opening perfectly.
Liesbeth and Jan are building a robot for a course project and have discovered that they need to fit two pieces of Lego into an opening.
The opening is x centimetres wide and the sum of the lengths of the two pieces has to be precisely equal to the width of the opening, or else the robot will break during the project demonstration, with catastrophic consequences for the grades of the two students.
Luckily, Liesbeth and Jan were able to sneak into the physics laboratory late one night to measure the lengths of their remaining Lego pieces very accurately. Now they just need to select two pieces that will fit the opening perfectly.
Input specification
For each test case, you get:
 a line containing one positive integer: x, denoting the width of the opening in centimetres, with 1 <= x <= 20.
 a line containing one nonnegative integer: n, denoting the remaining number of Lego pieces Liesbeth and Jan have access to, with 0 <= n <= 1000000.
 n lines containing positive integers l, denoting lengths of Lego pieces in nanometres. Liesbeth and Jan have told you that no piece of Lego is longer than 10 centimetres, or 100000000 nanometres.
For each test case, you get:
 a line containing one positive integer: x, denoting the width of the opening in centimetres, with 1 <= x <= 20.
 a line containing one nonnegative integer: n, denoting the remaining number of Lego pieces Liesbeth and Jan have access to, with 0 <= n <= 1000000.
 n lines containing positive integers l, denoting lengths of Lego pieces in nanometres. Liesbeth and Jan have told you that no piece of Lego is longer than 10 centimetres, or 100000000 nanometres.
For each test case, you get:
 a line containing one positive integer: x, denoting the width of the opening in centimetres, with 1 <= x <= 20.
 a line containing one nonnegative integer: n, denoting the remaining number of Lego pieces Liesbeth and Jan have access to, with 0 <= n <= 1000000.
 n lines containing positive integers l, denoting lengths of Lego pieces in nanometres. Liesbeth and Jan have told you that no piece of Lego is longer than 10 centimetres, or 100000000 nanometres.
Output specification
For each test case, a row containing the word "danger" if no two pieces of Lego exist that precisely fit into the opening, or "yes l1 l2", with l1 <= l2, should two such pieces of lengths l1 and l2 exist. In case multiple solutions exist, a solution maximising the difference between l1 and l2 must be printed.
For each test case, a row containing the word "danger" if no two pieces of Lego exist that precisely fit into the opening, or "yes l1 l2", with l1 <= l2, should two such pieces of lengths l1 and l2 exist. In case multiple solutions exist, a solution maximising the difference between l1 and l2 must be printed.
For each test case, you get:
 a line containing one positive integer: x, denoting the width of the opening in centimetres, with 1 <= x <= 20.
 a line containing one nonnegative integer: n, denoting the remaining number of Lego pieces Liesbeth and Jan have access to, with 0 <= n <= 1000000.
 n lines containing positive integers l, denoting lengths of Lego pieces in nanometres. Liesbeth and Jan have told you that no piece of Lego is longer than 10 centimetres, or 100000000 nanometres.
Sample input
149999998129999999
Sample output
yes 1 9999999
Hint(s)
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/