Logo
(追記) (追記ここまで)

31112번 - Cryptography 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB75571.429%

문제

Given three arrays $f,ドル $g,ドル $h$ of length 2ドル^m,ドル Bobo defines a cryptographic function $\mathrm{enc}(x, y) = (a, b)$ where

  • $a = y \oplus g[x \oplus f[y]],ドル
  • $b = x \oplus f[y] \oplus h[y \oplus g[x \oplus f[y]]]$.

He also has $q$ questions $(a_1, b_1), \dots, (a_q, b_q)$.

For each $(a_i, b_i),ドル find a pair of integers $(x, y)$ where 0ドル \leq x, y < 2^m$ and $\mathrm{enc}(x, y) = (a_i, b_i)$. It is guaranteed that for each $(a_i, b_i),ドル there exists a unique pair $(x, y)$ satisfying the condition.

Note: $\oplus$ denotes the bitwise exclusive-or, i.e., xor.

입력

The input consists of several test cases terminated by end-of-file. For each test case,

The first line contains two integers $m$ and $q$.

The second line contains 2ドル^m$ integers $f[0], \dots, f[2^m - 1]$.

The third line contains 2ドル^m$ integers $g[0], \dots, g[2^m - 1]$.

The forth line contains 2ドル^m$ integers $h[0], \dots, h[2^m - 1]$.

For the following $q$ lines, the $i$-th line contains two integers $a_i$ and $b_i$.

출력

For each question, output two integers which denote the found $x$ and $y$.

제한

  • 1ドル \le m \leq 16$
  • 1ドル \leq q \leq 10^5$
  • 0ドル \leq f[i], g[i], h[i] < 2^m$ for each 0ドル \leq i < 2^m$
  • 0ドル \leq a_i, b_i < 2^m$ for each 1ドル \leq i \leq q$
  • In each input, the sum of 2ドル^m$ does not exceed 10ドル^5$. The sum of $q$ does not exceed 10ドル^5$.

예제 입력 1

2 2
0 1 2 3
1 2 3 0
2 3 0 1
0 1
2 3
1 1
0 0
0 0
0 0
0 0

예제 출력 1

3 0
1 2
0 0

노트

출처

Contest > Open Cup > 2020/2021 Season > Stage 18: Grand Prix of Beijing C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /