#C8560. Arm the Night's Watch
Arm the Night's Watch
Arm the Night's Watch
The Night's Watch must be armed with weapons from various stockpiles. You are given a list of stockpile counts and the number of rangers. Your task is to determine whether it is possible to supply every ranger with exactly one weapon.
Formally, given \(n\) stockpiles with weapon counts \(a_1, a_2, \dots, a_n\) and \(r\) rangers, check if \[ \sum_{i=1}^{n} a_i \ge r \]
If this inequality holds, print Defend the realm!
; otherwise, print Retreat!
.
inputFormat
The input consists of one or two lines.
- The first line contains two integers \(n\) and \(r\) separated by a space, where \(n\) is the number of stockpiles and \(r\) is the number of rangers.
- If \(n > 0\), the second line contains \(n\) space-separated integers \(a_1, a_2, \dots, a_n\), representing the number of weapons in each stockpile. If \(n = 0\), the second line is omitted.
outputFormat
Output a single line containing either Defend the realm!
if the total number of weapons is at least \(r\), otherwise Retreat!
.
3 50
10 20 30
Defend the realm!