結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー titiatitia
提出日時 2022-04-08 22:46:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 9,364 KB
最終ジャッジ日時 2023-08-19 01:15:32
合計ジャッジ時間 5,017 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,768 KB
testcase_01 AC 15 ms
7,700 KB
testcase_02 AC 14 ms
7,800 KB
testcase_03 AC 21 ms
8,812 KB
testcase_04 AC 26 ms
9,276 KB
testcase_05 AC 27 ms
9,288 KB
testcase_06 AC 22 ms
9,008 KB
testcase_07 AC 27 ms
9,364 KB
testcase_08 AC 24 ms
9,032 KB
testcase_09 AC 24 ms
9,044 KB
testcase_10 AC 25 ms
9,096 KB
testcase_11 AC 24 ms
9,044 KB
testcase_12 AC 24 ms
9,032 KB
testcase_13 AC 23 ms
8,920 KB
testcase_14 AC 23 ms
8,896 KB
testcase_15 AC 23 ms
8,948 KB
testcase_16 AC 22 ms
8,960 KB
testcase_17 AC 22 ms
8,888 KB
testcase_18 AC 17 ms
8,380 KB
testcase_19 AC 15 ms
8,460 KB
testcase_20 AC 19 ms
8,844 KB
testcase_21 AC 17 ms
8,560 KB
testcase_22 AC 22 ms
8,948 KB
testcase_23 AC 22 ms
9,016 KB
testcase_24 AC 21 ms
9,112 KB
testcase_25 AC 21 ms
8,888 KB
testcase_26 AC 21 ms
9,016 KB
testcase_27 AC 21 ms
9,052 KB
testcase_28 AC 21 ms
8,856 KB
testcase_29 AC 21 ms
8,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

def ansplus(t,i,j):
    ANS.append((t,i+1,j+1))
    if t==1:
        A[i]^=B[j]
    else:
        B[j]^=A[i]
        

ANS=[]
A_MAX_IND=A.index(max(A))
B_MAX_IND=B.index(max(B))

b1=max(A).bit_length()
b2=max(B).bit_length()

if b1<b2:
    for j in range(N):
        if A[j].bit_length()<b2:
            ansplus(1,j,B_MAX_IND)
            A_MAX_IND=j
            break

b1=max(A).bit_length()

for i in range(N):
    if B[i].bit_length()<b1:
        ansplus(2,A_MAX_IND,i)

#print(A)
#print(B)

for i in range(N):
    if A[i].bit_length()==b1:
        ansplus(1,i,0)


#print(A)
#print(B)

print(len(ANS))
for x,y,z in ANS:
    print(x,y,z)
        
        
        
0