시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB72332356.098%

문제

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.

  1. Tairitsu receives a binary sequence $S$ of length $196$. Subsequently, Tairitsu constructs a $13\times 13$ matrix $A$ where each element is between $0$ and $15$.
  2. The Trial of Karma involves selecting positive integers $1 \le r_1 < r_2 < \ldots < r_7 \le 13$ and $1 \le c_1 < c_2 < \ldots < c_7 \le 13$. Then create a $7\times 7$ matrix $B$ such that the $i$th row and $j$th column of $B$ is $A_{r_i,c_j}$. Chunipenguin is given this matrix $B$ and the values $r_1, r_2, \ldots, r_7, c_1, c_2, \ldots, c_7$.
  3. Chunipenguin must determine $S$ by examining $B$.

Let's help Tairitsu and Chunipenguin overcome the trials of karma!

입력

The first line contains an integer $t$ that is either $0$ or $1$. If $t=0$, it means you must execute Tairitsu's strategy; if $t=1$, it means you must execute Chunipenguin's strategy.

If $t=0$, the next line contains $196$ integers, either $0$ or $1$, given without spaces. This represents the binary sequence $S$ received by Tairitsu.

If $t=1$, a total of $7$ positive integers are given over two lines. The $i$th integer on the first line is $r_i$, and the $i$th integer on the second line is $c_i$.

Subsequently, over the next $7$ lines, $7$ integers are given per line, separated by spaces. The $j$th element on the $i$th line represents $B_{ij}$.

출력

If $t=0$, the program must output a total of $13$ lines, each containing $13$ numbers separated by spaces, where the $j$th element on the $i$th line represents $A_{ij}$.

If $t=1$, the program must output a total of $196$ integers, either $0$ or $1$, on a single line without spaces. This must be the binary sequence $S$ that Tairitsu initially received.

예제 입력 1

0
000...000

예제 출력 1

0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0

예제 입력 2

1
1 2 3 4 5 6 7
1 2 3 4 5 6 7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

예제 출력 2

000...000

출처

University > KAIST > KAIST ICPC Mock Competition > 2025 KAIST 15th ICPC Mock Competition M번

University > MIT > The MIT Programming Contest > 2025-26 > MIT Team Contest 2 M번

채점 및 기타 정보

  • 예제는 채점하지 않는다.