Array's Game
Submissions: 428   Accuracy:


  Difficulty: Easy   Marks: 2

Anik and Kundan are good friends, but when it comes to studies they love to compete with each other and win. The task at hand was that they were given an array of numbers of size N, they have to make the all the element of the array equal. In each of their turn they can choose any element and increase it by 1. The one playing the last move which makes the whole array equal wins.
Before starting to play they saw that in some case the game may never end as any of the player if find themselve loosing may misuse their chance and the game may go infinetely long. So to prevent that situation they decided to add more rules to the game.
The rules are:
1. From all the elements in the array ( before the game starts) the elements which are maximum ( they call it as "top" ) in the array can never be changed.
2. Once the game starts, if any of the elements after some moves becomes top then in the further progress of the game that element cannot be changed.

The first line of the test case contains an integer T, denoting number of test cases. The first line of each test case contains an integer N denoting the size of the array. The second line contains N space separated integers denoting the initial array.

Given the initial array you need to find the winner , provided both the player will play optimally. Print "Anik" if Anik wins the game, "Draw" if no one can make any moves else "Kundan".Anik will always play the first chance.

1 <= T <= 103
1 <= N <= 102
1 <= A[i] <= 109

1 2


** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.