結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,352 KB
testcase_01 AC 37 ms
52,608 KB
testcase_02 AC 39 ms
52,352 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 132 ms
77,492 KB
testcase_09 AC 131 ms
77,808 KB
testcase_10 AC 135 ms
77,944 KB
testcase_11 AC 141 ms
77,564 KB
testcase_12 AC 143 ms
77,484 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 101 ms
77,056 KB
testcase_19 AC 78 ms
71,168 KB
testcase_20 AC 105 ms
77,316 KB
testcase_21 AC 68 ms
70,656 KB
testcase_22 AC 119 ms
77,784 KB
testcase_23 AC 122 ms
77,556 KB
testcase_24 AC 123 ms
77,436 KB
testcase_25 AC 127 ms
77,568 KB
testcase_26 AC 135 ms
77,696 KB
testcase_27 AC 127 ms
77,824 KB
testcase_28 AC 79 ms
75,008 KB
testcase_29 AC 78 ms
75,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
D=dict()
C=0
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
    C+=1
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]
  if (A[X] in B)and(A[X]>0):
    for j in range(N):
      if C==N:
        break
      if A[X]==B[j]:
        ANS.append((2,X+1,j+1))
        B[j]=0
        C+=1
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