Preparing NOJ

# North Pole Retirement

1000ms 262144K

## Description:

Santa has gotten quite old and is entering retirement. To get ready, he'd like to practice playing some bingo.

Santa plays a special type of bingo on a $N \times N$ grid, where each cell contains a unique number between $1$ and $N^2$. Some permutations of these numbers are called out successively. When a full row or column is called out, Santa wins!

Given Santa's board and the order in which the numbers are called, determine which number Santa will win with.

## Input:

A single integer, $2 \leq N \leq 100$.

An $N \times N$ grid with numbers $1...N^2$, showing the board

The $N^2$ numbers, in the order they're called

## Output:

The number that will cause Santa to win

## Sample Input:

3
2 7 9
8 3 1
6 5 4
4 6 8 7 5 3 2 9 1


## Sample Output:

5


## Note:

Note that the first row/column to fill up is the bottom row.

Info

Provider CodeForces Gym

Code GYM103380B

Tags

Submitted 0

Passed 0

AC Rate 0%

Date 10/31/2021 14:46:35

Related

Nothing Yet