列表

详情


NC25049. [USACO 2007 Feb L]Cow Bingo

描述

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

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

上一题