## LCC/Moose '19 Contest 3 S5 - Konnect

View as PDF

Points: 20 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

One of Ashley and Oleg's presents was a board game called Konnect, which is a game where two players take turns dropping pieces of their color into a 2D grid and the first person to get pieces of their color in a row horizontally, vertically, or diagonally wins.

Ashley and Oleg recorded the sequence of moves that were played during one of their games, but they have since forgotten the result of the game. Could you help figure out who won?

#### Input Specification

The input begins with two integers , the number of moves that were played and the value . The next line contains integers , which say that the -th move was played in column . The two players alternate making moves, with Ashley going first.

For 30% of cases, .
For 50% of cases, .

#### Output Specification

Output the winner of the game (Ashley or Oleg) as well as the turn on which the game ended (it is possible the game ends before the last move). It is guaranteed that the game ends with a winner.

#### Sample Input 1

8 4
1 2 1 2 1 2 1 2

#### Sample Output 1

Ashley 7

#### Sample Input 2

4 2
1 1 1 2

#### Sample Output 2

Oleg 4