[USACO 2007 Feb L]Cow Bingo
题号:NC25049
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

The cows are playing bingo and FJ is watching. You've probably played bingo: Given a 5 x 5 array of unique small integers, your goal is to fill in five in a row either horizontally, verttically, or on one of the two diagonals. Some bingo cards have a 'free' spot in the middle; the cows' bingo cards do not.
Bessie wants to know what numbers she should cheer for. She has a partially filled in bingo card (i.e., at least one number has been picked). Your job is to figure out which number(s) she wants in order to win most quickly (i.e., the smallest set of numbers that will get her to a victory).
The smallest set is unique for all the sample cards.

输入描述:

Lines 1..5: Each line contains five space-separated integers that are one row of a bingo card. Those numbers which have already been called are represented as the negative version of themselves (i.e., -7 means 7 has already been called).

输出描述:

Line 1: Between one and four integers that will get Betsy to a win with the shortest number of bingo draws. The numbers should be presented in ascending order.
示例1

输入

复制
1 2 3 4 5
-6 -7 8 -9 -10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

输出

复制
8