Ограничения: время – 250ms/500ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)
Gaal Dornick and Hari Seldon decided to play a game with following rules.
There are `N` buckets where `i`th bucket contains `B_i` balls initially.
1. Both players take turns with Gaal going first.
2. If there are no balls left, the game ends.
3. In his/her turn, the player will remove a ball from any bucket which contains at least one ball.
4. If, after the move, the bucket from which the ball is removed becomes empty, the player gets a point.
If both players play optimally, find the player who will get more points. If both players get same points, print ``Draw``.
The first line of input contains `N` (`1 <= N <= 10^5`) -- the number of buckets. The second line contains `N` space-separated integers
`B_i` (`1 <= B_i <=10^9`) -- the number of balls in `i`th bucket initially.
Output ``Gaal``, if Gaal gets more points; or ``Hari``, if Hari gets more points; else ``Draw``, if both get same number of points.
```sample Sample Input 1
3
1 2 3
```
```sample Sample Output 1
Hari
```
```sample Sample Input 2
3
3 3 3
```
```sample Sample Output 2
Gaal
```
Expain for sample 1.
* Gaal picks a ball from first bucket and gets a point.
* Hari picks a ball from third bucket.
* Gaal picks a ball from second bucket.
* Hari picks a ball from second bucket and gets a point.
* Gaal picks a ball from third bucket.
* Hari picks a ball from third bucket and gets a point.
* Game ends. Thus, Hari has more points than Gaal.