結果

問題 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  
実行時間 50 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-05-06 08:25:15
合計ジャッジ時間 4,974 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 25 ms
10,752 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 35 ms
11,136 KB
testcase_04 AC 44 ms
11,776 KB
testcase_05 AC 50 ms
11,648 KB
testcase_06 AC 40 ms
11,392 KB
testcase_07 AC 45 ms
11,648 KB
testcase_08 AC 41 ms
11,520 KB
testcase_09 AC 40 ms
11,392 KB
testcase_10 AC 40 ms
11,520 KB
testcase_11 AC 41 ms
11,392 KB
testcase_12 AC 42 ms
11,392 KB
testcase_13 AC 37 ms
11,264 KB
testcase_14 AC 39 ms
11,264 KB
testcase_15 AC 38 ms
11,264 KB
testcase_16 AC 39 ms
11,264 KB
testcase_17 AC 38 ms
11,264 KB
testcase_18 AC 33 ms
11,136 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 AC 36 ms
11,264 KB
testcase_21 AC 30 ms
10,880 KB
testcase_22 AC 38 ms
11,520 KB
testcase_23 AC 39 ms
11,392 KB
testcase_24 AC 37 ms
11,392 KB
testcase_25 AC 38 ms
11,392 KB
testcase_26 AC 38 ms
11,520 KB
testcase_27 AC 37 ms
11,392 KB
testcase_28 AC 37 ms
11,264 KB
testcase_29 AC 36 ms
11,392 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