Misdeed -la bonté de Dieu et l'origine du mal-
시간 제한5초메모리 제한1024 MB
196개의 비트를 13x13 행렬에 부호화해, 어떤 7개 행과 7개 열을 골라도 원래 비트열이 복원되도록 한다.
문제
This is a two-step problem.
Tairitsu and Chunipenguin join forces to overcome the Trial of Karma. The Trial of Karma is structured as follows.
- Tairitsu receives a binary sequence of length . Subsequently, Tairitsu constructs a matrix where each element is between and .
- The Trial of Karma involves selecting positive integers and . Then create a matrix such that the th row and th column of is . Chunipenguin is given this matrix and the values .
- Chunipenguin must determine by examining .
Let's help Tairitsu and Chunipenguin overcome the trials of karma!
입력
The first line contains an integer that is either or . If , it means you must execute Tairitsu's strategy; if , it means you must execute Chunipenguin's strategy.
If , the next line contains integers, either or , given without spaces. This represents the binary sequence received by Tairitsu.
If , a total of positive integers are given over two lines. The th integer on the first line is , and the th integer on the second line is .
Subsequently, over the next lines, integers are given per line, separated by spaces. The th element on the th line represents .
출력
If , the program must output a total of lines, each containing numbers separated by spaces, where the th element on the th line represents .
If , the program must output a total of integers, either or , on a single line without spaces. This must be the binary sequence that Tairitsu initially received.