Zig-zag

Write a program that reads several matrices of integer numbers, and that
for each one tells whether the result of traversing it in zig-zags is a
strictly increasing sequence. We must start at the top-left position, go
down the first column, up the second column, down the third column, and
so on.

Input

Input consists of several matrices, each with the number of rows r ≥ 1
and the number of columns c ≥ 1, followed by r rows with c integer
numbers each.

Output

For every matrix, print its number followed by either “yes” o “no”,
depending on whether the zig-zag traversal of the matrix generates a
strictly increasing sequence or not.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:39:53.943Z

© Jutge.org, 2006–2026.
https://jutge.org
