n in a row

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

A and B are playing n-in-a-row. The rule of this game is: two players put chess pieces onto a chess board that has the following positions: (1,1) on the upper left, and (n,n) on the lower right. If a player's n chess pieces form a row, a column, or a diagonal line, the other player loses.

A plays first, and there are m rounds. Please determine who won the game.

A game will end if and only if someone won, or there are no rounds left. If the upper conditions are fulfilled, the game ends, and the remaining rounds are ignored.

Inputs 2 numbers(n and m), which represent the size of the chessboard and the number of rounds.

x and y will be inputted in the next m lines. These show that the current player will put a chess piece on row x, column y.

Outputs a line, which include an integer x, which shows the number of rounds played when the game ends. Also, output a string S, which demonstrates the result of the game. These two outputs are separated using a space.

If A won, S is "milk!". If B won, S is "juice!". Otherwise, S is "drawn!".

Options

exec is denied

rejudge feature is enabled

now post-mortem time, all source codes will be revealed

Sample input:_

2 4
1 1
2 2
2 1
1 2

Sample output:

3 milk!

Ranking

return to the top page