結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー googol_S0googol_S0
提出日時 2022-04-08 22:26:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 580 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 79,648 KB
最終ジャッジ日時 2023-08-19 00:54:55
合計ジャッジ時間 7,843 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,036 KB
testcase_01 AC 61 ms
71,036 KB
testcase_02 AC 59 ms
71,152 KB
testcase_03 WA -
testcase_04 AC 140 ms
78,960 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 117 ms
78,660 KB
testcase_09 AC 119 ms
78,884 KB
testcase_10 AC 118 ms
78,528 KB
testcase_11 AC 118 ms
78,688 KB
testcase_12 AC 116 ms
78,740 KB
testcase_13 AC 127 ms
78,984 KB
testcase_14 AC 126 ms
78,824 KB
testcase_15 AC 125 ms
78,912 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 92 ms
78,104 KB
testcase_19 AC 79 ms
76,904 KB
testcase_20 AC 103 ms
78,360 KB
testcase_21 AC 86 ms
77,052 KB
testcase_22 AC 123 ms
78,728 KB
testcase_23 AC 116 ms
78,648 KB
testcase_24 AC 122 ms
78,656 KB
testcase_25 AC 114 ms
78,660 KB
testcase_26 AC 115 ms
78,444 KB
testcase_27 AC 115 ms
78,676 KB
testcase_28 AC 85 ms
78,364 KB
testcase_29 AC 84 ms
78,296 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]
D=dict()
for i in range(N):
  D[B[i]]=i
for i in range(N):
  v=D.get(A[i],-1)
  if v>=0:
    ANS.append((1,i+1,v+1))
    A[i]=0
print(len(ANS))
for i in range(len(ANS)):
  print(*ANS[i])
0