Cody

Problem 44647. Win all the time!

This is a 2-players game. One of them is your algorithm. Your algorithm must win in all games.

In this game there are 3 rows and every row has some lines like this:

1) ||||||||||
2) ||||||||
3) |||||

You can choose a row and remove some lines from the row.

Rule 1: You should remove the lines only in one row.

Rule 2: In your turn, you should remove at least one line.

As input you have row info like this:

[4,5,6]

It means there are 4 lines in row1, 5 lines in row2 and 6 lines in row3.

You should return 2 numbers as output that one of them is row number and other is number of lines you want to remove from the row.

This function repeated to remove all the lines. If you remove the last line, you lose. So you should force your competitor to take the last line.

At the start it's your turn and input is [10,10,10].

Good luck!

Solution Stats

29.69% Correct | 70.31% Incorrect
Last Solution submitted on May 09, 2019

Problem Comments

Problem Recent Solvers8

Suggested Problems

More from this Author18

Problem Tags