#P11033. Bingo Board Checker

    ID: 13086 Type: Default 1000ms 256MiB

Bingo Board Checker

Bingo Board Checker

Given a (5\times5) chessboard consisting of 25 cells, each cell may either contain a piece or be empty. There are 12 lines on the board: 5 rows, 5 columns, and 2 diagonals. A board is considered bingo if at least one of these lines has all its cells occupied by pieces. The main diagonal is defined as the cells at positions ( (i, i) ) for ( i=0,1,...,4 ), and the anti-diagonal is defined as the cells at positions ( (i, 4-i) ) for ( i=0,1,...,4 ).

Your task is to determine whether the given board is bingo.

inputFormat

The input consists of 5 lines. Each line contains 5 integers separated by spaces. Each integer is either 0 or 1, where 1 indicates that the cell contains a piece and 0 indicates that it is empty.

outputFormat

Output a single line containing Yes if the board is bingo (i.e. at least one complete line is filled with pieces); otherwise, output No.

sample

1 1 1 1 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
Yes