結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー HydruHydru
提出日時 2022-04-09 00:42:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 888 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,952 KB
最終ジャッジ日時 2024-05-06 10:15:09
合計ジャッジ時間 6,796 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,224 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 85 ms
77,184 KB
testcase_05 AC 83 ms
77,196 KB
testcase_06 WA -
testcase_07 AC 84 ms
77,396 KB
testcase_08 AC 85 ms
77,056 KB
testcase_09 AC 88 ms
77,184 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 83 ms
77,056 KB
testcase_13 WA -
testcase_14 AC 74 ms
77,228 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 67 ms
74,112 KB
testcase_29 AC 73 ms
76,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def max_ind(X):
    M=X[0]
    ind=0
    for i in range(1,len(X)):
        if M<X[i]:
            M,ind=X[i],ind
    return M,ind
max_A,ind_A = max_ind(A)
max_B,ind_B = max_ind(B)

def len_bit(N):
    val=1
    count=0
    while(val<=N):
        val*=2
        count+=1
    return count

ans=[]
if len_bit(max_A)<len_bit(max_B):
    max_A^=max_B
    A[ind_A]^=max_B
    ans.append((1,ind_A,ind_B))
if len_bit(max_A)>len_bit(B[0]):
    ans.append((2,ind_A,0))
    B[0]^=max_A


bit_b=len_bit(B[0])
for i in range(N-1):
    if len_bit(A[i])==bit_b:
        ans.append((1,i,0))

if len_bit(A[N-1])<bit_b:
    ans.append((1,N,0))
    A[N-1]^=bit_b

max_A=A[N-1]

for i in range(1,N):
    if B[i]<max_A:
        ans.append((2,N-1,i))

ans.append((1,N-1,0))
print(len(ans))
for t,p,q in ans:
    print(t,p+1,q+1)
0