結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー ytftytft
提出日時 2022-04-09 04:44:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 78,080 KB
最終ジャッジ日時 2024-05-06 15:52:14
合計ジャッジ時間 6,815 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,608 KB
testcase_01 AC 41 ms
52,352 KB
testcase_02 AC 40 ms
52,096 KB
testcase_03 AC 83 ms
76,544 KB
testcase_04 AC 84 ms
77,824 KB
testcase_05 AC 83 ms
77,696 KB
testcase_06 AC 80 ms
76,952 KB
testcase_07 AC 85 ms
78,080 KB
testcase_08 AC 86 ms
77,184 KB
testcase_09 AC 84 ms
77,348 KB
testcase_10 AC 86 ms
77,264 KB
testcase_11 AC 85 ms
77,696 KB
testcase_12 AC 85 ms
77,056 KB
testcase_13 AC 88 ms
77,440 KB
testcase_14 AC 87 ms
77,140 KB
testcase_15 AC 85 ms
77,316 KB
testcase_16 AC 84 ms
77,184 KB
testcase_17 AC 84 ms
77,184 KB
testcase_18 AC 81 ms
76,416 KB
testcase_19 AC 62 ms
67,968 KB
testcase_20 AC 85 ms
77,044 KB
testcase_21 AC 64 ms
68,352 KB
testcase_22 AC 87 ms
77,132 KB
testcase_23 AC 86 ms
76,928 KB
testcase_24 AC 88 ms
77,148 KB
testcase_25 AC 87 ms
77,184 KB
testcase_26 AC 88 ms
77,056 KB
testcase_27 AC 89 ms
76,672 KB
testcase_28 AC 81 ms
77,056 KB
testcase_29 AC 81 ms
76,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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