結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2022-04-14 12:15:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 696 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 31,068 KB
最終ジャッジ日時 2023-08-25 20:17:37
合計ジャッジ時間 9,425 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
29,588 KB
testcase_01 AC 126 ms
29,616 KB
testcase_02 AC 126 ms
29,656 KB
testcase_03 AC 134 ms
30,368 KB
testcase_04 AC 147 ms
31,036 KB
testcase_05 AC 143 ms
31,068 KB
testcase_06 AC 135 ms
30,460 KB
testcase_07 AC 144 ms
30,856 KB
testcase_08 AC 140 ms
30,532 KB
testcase_09 AC 139 ms
30,580 KB
testcase_10 AC 141 ms
30,540 KB
testcase_11 AC 141 ms
30,400 KB
testcase_12 AC 142 ms
30,576 KB
testcase_13 AC 139 ms
30,320 KB
testcase_14 AC 137 ms
30,416 KB
testcase_15 AC 138 ms
30,376 KB
testcase_16 AC 139 ms
30,152 KB
testcase_17 AC 138 ms
30,492 KB
testcase_18 AC 135 ms
30,180 KB
testcase_19 AC 131 ms
29,980 KB
testcase_20 AC 134 ms
30,440 KB
testcase_21 AC 130 ms
30,176 KB
testcase_22 AC 138 ms
30,560 KB
testcase_23 AC 140 ms
30,588 KB
testcase_24 AC 138 ms
30,376 KB
testcase_25 AC 139 ms
30,372 KB
testcase_26 AC 137 ms
30,560 KB
testcase_27 AC 138 ms
30,524 KB
testcase_28 AC 134 ms
30,388 KB
testcase_29 AC 136 ms
30,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(n,a,b,ans):
    for t,p,q in ans:
        if t==1:
            a[p]=a[p]^b[q]
        else:
            b[q]=a[p]^b[q]
    print(a)
    print(b)
    return max(a)<min(b)
def solv(n,a,b):
    import numpy as np
    ans=[]
    q=np.argmax(a)
    bit=1 # a[q]の最上位bit
    while bit<=a[q]:bit<<=1
    bit>>=1
    for i in range(n):
        if bit^b[i]>b[i]:
            ans.append([2,q,i])
    q=np.argmin(b)
    for i in range(n):
        if bit^a[i]<a[i]:
            ans.append([1,i,q])
    return ans

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=solv(n,a,b)
#print(check(n,a,b,ans))
print(len(ans))
for t,p,q in ans:
    print(t,p+1,q+1)
0