結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー prussian_coderprussian_coder
提出日時 2022-04-09 11:16:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 1,615 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 78,652 KB
最終ジャッジ日時 2023-08-19 15:10:13
合計ジャッジ時間 10,779 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,088 KB
testcase_01 AC 71 ms
71,356 KB
testcase_02 AC 71 ms
71,092 KB
testcase_03 AC 106 ms
78,184 KB
testcase_04 AC 103 ms
78,440 KB
testcase_05 AC 104 ms
78,388 KB
testcase_06 AC 100 ms
78,020 KB
testcase_07 AC 103 ms
78,516 KB
testcase_08 AC 102 ms
78,440 KB
testcase_09 AC 104 ms
78,200 KB
testcase_10 AC 104 ms
78,456 KB
testcase_11 AC 104 ms
78,368 KB
testcase_12 AC 104 ms
78,128 KB
testcase_13 AC 104 ms
78,652 KB
testcase_14 AC 103 ms
78,176 KB
testcase_15 AC 102 ms
78,124 KB
testcase_16 AC 103 ms
78,396 KB
testcase_17 AC 104 ms
78,120 KB
testcase_18 AC 97 ms
77,520 KB
testcase_19 AC 85 ms
76,676 KB
testcase_20 AC 103 ms
78,544 KB
testcase_21 AC 87 ms
76,484 KB
testcase_22 AC 104 ms
78,444 KB
testcase_23 AC 104 ms
78,636 KB
testcase_24 AC 107 ms
78,492 KB
testcase_25 AC 106 ms
78,652 KB
testcase_26 AC 104 ms
78,480 KB
testcase_27 AC 104 ms
78,480 KB
testcase_28 AC 100 ms
78,100 KB
testcase_29 AC 99 ms
78,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
d = len(bin(max(max(A),max(B))))-3
dA = [(a>>d)&1 for a in A]
dB = [(a>>d)&1 for a in B]
ans=[]
if sum(dB)==0:
	a = dA.index(1)
	ans.append((2,a+1,1))
	dB[0]=1
	B[0]^=A[a]
b = dB.index(1)	
for i in range(N):
	if dA[i]==1:
		ans.append((1,i+1,b+1))
		dA[i]=0
		A[i]^=B[b]
		
ans.append((1,1,b+1))
A[0]^=B[b]
dA[0]=1
for i in range(N):
	if dB[i]==0:
		ans.append((2,1,i+1))
		dB[i]=1
		B[i]^=A[0]
ans.append((1,1,1))
print(len(ans))
[print(*a) for a in ans]
A[0]^=B[0]
dA[0]=0
0