結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー googol_S0googol_S0
提出日時 2022-04-08 22:22:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 78,080 KB
最終ジャッジ日時 2024-05-06 07:55:30
合計ジャッジ時間 7,627 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,712 KB
testcase_01 AC 41 ms
51,584 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 150 ms
77,568 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 96 ms
76,544 KB
testcase_19 AC 77 ms
70,272 KB
testcase_20 AC 109 ms
77,056 KB
testcase_21 AC 79 ms
69,760 KB
testcase_22 AC 121 ms
77,184 KB
testcase_23 AC 123 ms
77,312 KB
testcase_24 AC 121 ms
76,928 KB
testcase_25 AC 123 ms
77,184 KB
testcase_26 AC 122 ms
77,184 KB
testcase_27 AC 119 ms
77,312 KB
testcase_28 AC 77 ms
72,704 KB
testcase_29 AC 78 ms
72,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
D=dict()
for i in range(N):
  D[B[i]]=i
ANS=[]
for i in range(N):
  v=D.get(A[i],-1)
  if v>=0:
    ANS.append((1,i+1,v+1))
    A[i]=0
while max(A)>min(B):
  X=A.index(max(A))
  Y=B.index(min(B))
  ANS.append((1,X+1,Y+1))
  ANS.append((2,X+1,Y+1))
  ANS.append((1,X+1,Y+1))
  A[X]^=B[Y]
  B[Y]^=A[X]
  A[X]^=B[Y]
print(len(ANS))
for i in range(len(ANS)):
  print(*ANS[i])
0