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

Ruby2 _

RankUserSizeTimeDateStatistics
1pooq130.05142019/08/14 04:38:280B / ?B / ?B

Python3 _

RankUserSizeTimeDateStatistics
1c_r_5160.03952019/05/01 09:33:580B / ?B / ?B

PHP _

RankUserSizeTimeDateStatistics
1c_r_570.03922019/05/01 09:35:070B / ?B / ?B

Common LISP _

RankUserSizeTimeDateStatistics
1pooq170.01822019/10/13 13:53:500B / ?B / ?B

Arc _

RankUserSizeTimeDateStatistics
1pooq130.70062019/08/08 11:25:140B / ?B / ?B

Clojure _

RankUserSizeTimeDateStatistics
1pooq160.60112019/08/10 05:30:370B / ?B / ?B

Io _

RankUserSizeTimeDateStatistics
1pooq140.04992019/07/17 06:35:280B / ?B / ?B

JavaScript _

RankUserSizeTimeDateStatistics
1pooq160.01192019/10/09 07:25:280B / ?B / ?B

Tcl _

RankUserSizeTimeDateStatistics
1pooq140.01332019/08/19 11:21:290B / ?B / ?B

Xtal _

RankUserSizeTimeDateStatistics
1pooq120.01252019/08/08 17:21:180B / ?B / ?B

Crystal _

RankUserSizeTimeDateStatistics
1pooq140.00012019/08/12 18:06:570B / ?B / ?B

REXX _

RankUserSizeTimeDateStatistics
1pooq120.01892019/10/13 20:39:150B / ?B / ?B

PARI/GP _

RankUserSizeTimeDateStatistics
1pooq210.01162019/08/10 04:22:350B / ?B / ?B

Squirrel _

RankUserSizeTimeDateStatistics
1pooq160.00012019/08/04 07:52:480B / ?B / ?B

Prolog _

RankUserSizeTimeDateStatistics
1pooq210.01382019/10/14 07:10:440B / ?B / ?B

Forth _

RankUserSizeTimeDateStatistics
1pooq100.01132019/08/15 13:20:070B / ?B / ?B

BASIC _

RankUserSizeTimeDateStatistics
1pooq100.00012019/07/16 15:46:470B / ?B / ?B

J _

RankUserSizeTimeDateStatistics
1pooq160.06992019/09/01 22:01:060B / ?B / ?B

C++ _

RankUserSizeTimeDateStatistics
1pooq340.00022019/10/13 18:43:480B / ?B / ?B

Rust _

RankUserSizeTimeDateStatistics
1pooq280.01122019/10/12 08:05:180B / ?B / ?B

Pascal _

RankUserSizeTimeDateStatistics
1pooq270.00012019/10/13 16:29:010B / ?B / ?B

Chapel _

RankUserSizeTimeDateStatistics
1pooq170.01212019/08/11 10:44:110B / ?B / ?B

Maxima _

RankUserSizeTimeDateStatistics
1pooq180.44292019/10/17 12:17:290B / ?B / ?B

Octave _

RankUserSizeTimeDateStatistics
1pooq130.33232019/07/16 14:05:410B / ?B / ?B

REBOL _

RankUserSizeTimeDateStatistics
1pooq210.01852019/08/15 11:48:070B / ?B / ?B

Asymptote _

RankUserSizeTimeDateStatistics
1pooq150.21302019/07/24 11:15:310B / ?B / ?B

jq _

RankUserSizeTimeDateStatistics
1pooq90.01052019/07/15 19:00:330B / ?B / ?B

bc _

RankUserSizeTimeDateStatistics
1pooq100.01092019/07/24 04:48:470B / ?B / ?B

dc _

RankUserSizeTimeDateStatistics
1pooq100.00012019/10/15 09:36:340B / ?B / ?B

m4 _

RankUserSizeTimeDateStatistics
1pooq70.00012019/08/19 12:55:370B / ?B / ?B

Postscript _

RankUserSizeTimeDateStatistics
1pooq100.07162019/10/06 06:15:520B / ?B / ?B

R _

RankUserSizeTimeDateStatistics
1pooq140.10552019/07/27 13:04:090B / ?B / ?B

QCL _

RankUserSizeTimeDateStatistics
1pooq160.04232019/08/08 19:17:300B / ?B / ?B

><> _

RankUserSizeTimeDateStatistics
1pooq120.05322019/10/16 11:06:090B / ?B / ?B

Burlesque _

RankUserSizeTimeDateStatistics
1pooq110.01312019/08/03 08:00:130B / ?B / ?B

z80 _

RankUserSizeTimeDateStatistics
1McBusLuck130.01202019/07/13 02:31:025B / 3B / 5B

DOS _

RankUserSizeTimeDateStatistics
1McBusLuck152.62102019/05/18 05:44:435B / ?B / ?B

goruby _

RankUserSizeTimeDateStatistics
1pooq100.01892019/08/21 05:19:550B / ?B / ?B

Groovy _

RankUserSizeTimeDateStatistics
1pooq161.05922019/07/28 20:19:180B / ?B / ?B

Language Ranking_

RankLangUserSizeScore
1PHPc_r_5710000
2m4pooq710000
3jqpooq97777
4BASICpooq107000
5bcpooq107000
6Forthpooq107000
7gorubypooq107000
8Postscriptpooq107000
9dcpooq107000
10Burlesquepooq116363
11Xtalpooq125833
12REXXpooq125833
13><>pooq125833
14z80McBusLuck135384
15Octavepooq135384
16Arcpooq135384
17Ruby2pooq135384
18Iopooq145000
19Rpooq145000
20Crystalpooq145000
21Tclpooq145000
22DOSMcBusLuck154666
23Asymptotepooq154666
24Python3c_r_5164375
25Groovypooq164375
26Squirrelpooq164375
27QCLpooq164375
28Clojurepooq164375
29Jpooq164375
30JavaScriptpooq164375
31Chapelpooq174117
32Common LISPpooq174117
33Maximapooq183888
34PARI/GPpooq213333
35REBOLpooq213333
36Prologpooq213333
37Pascalpooq272592
38Rustpooq282500
39C++pooq342058

return to the top page