All Submissions


Problem Statement

Alice and Bob are playing a game called "City Map". The game consists of N cities numbered from 0 to N-1 and connected only by unidirected roads. They are also given N strings each of length N. The i-th string (beginning with i=0) will contain a '1' (all quotes are for clarity only) in position j if there is a road that leads directly from i to j, and a '0' if there is no road that leads directly from i to j. Alice needs to find the cities from which every other city can be reached. Bob needs to find the cities that can be reached from every other city. The score of each player is the total number of cities he/she can find. The winner of the game is the one who scores more points. Assuming both Alice and Bob play optimally, your task is to find out the winner, or if the game ends in a draw (in case they have equal scores).

Input Specifications

Input consists of several test cases, separated by blank lines
For each testcase, the first line contains N, the number of cities.
This is followed by N strings, each string in a separate line.
The last test case is followed by -1.

Output Specifications

For each test case, the output consists of two lines.
The first line prints "Alice Wins" or "Bob Wins" or "Draw".
The second line contains the scores of Alice and Bob respectively separated by a space.
Each test case is followed by a new line.

Constraints
  • 2 <= N <= 50
  • The i-th string will contain 0 in position i

Sample Input


3
010
000
110

4
0010
1000
1100
1000

5
01000
00100
00010
00001
10000

-1


Sample Output


Draw
1 1
Bob Wins
1 3
Draw
5 5


Languages: C,C++,C#,Java,JavaScript,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0