#P12560. [UTS 2024] Randomized Palindromes
[UTS 2024] Randomized Palindromes
题目描述
You are given a binary matrix consisting of zeroes and ones. Initially, you have an empty string . You start in the position (left-up corner) and move right or down. You append each element you have passed to the string in the respective order.
Tell whether it is possible to achieve being a palindrome. If yes, print the way it should pass to achieve that.
Note that each matrix is randomly generated.
输入格式
The first line contains the only integer --- the size of a matrix.
The following lines contain the characters --- description of the matrix.
The input matrix for the problem is picked across all possible valid matrices for the problem of size .
输出格式
Print if there is no such palindrome.
Otherwise, in the first line, print . In each of the following lines, print two integers and () --- the coordinates of the -th cell.
2
01
00
YES
0 0
0 1
1 1
4
0100
1010
0100
0001
NO
4
0010
1001
1010
0010
YES
0 0
0 1
0 2
0 3
1 3
2 3
3 3
提示
- ( points) ;
- ( points) ;
- ( points) ;
- ( points) ;
- ( points) no additional restrictions.