結果

問題 No.1896 Arrays and XOR Procedure 2
コンテスト
ユーザー ytft
提出日時 2022-04-09 04:44:22
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 595 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 284 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 82,432 KB
最終ジャッジ日時 2026-05-22 21:35:49
合計ジャッジ時間 5,741 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys,math
input=lambda:sys.stdin.readline().rstrip()
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
check=max(max(A),max(B))
p=pow(2,29-format(check,'030b').index('1'))
for i in range(N):
	A[i]=int(A[i]>=p)
	B[i]=int(B[i]>=p)
ans=[]
if max(A)==0:
	ind=B.index(1)
	ans.append([0,0,ind])
	for i in range(N):
		if B[i]==0:
			ans.append([1,0,i])
	ans.append([0,0,0])
else:
	ind=A.index(1)
	for i in range(N):
		if B[i]==0:
			ans.append([1,ind,i])
	for i in range(N):
		if A[i]:
			ans.append([0,i,0])
print(len(ans))
for i in ans:
	print(*[j+1 for j in i])
0