結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー googol_S0googol_S0
提出日時 2022-04-08 22:41:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 696 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 78,704 KB
最終ジャッジ日時 2024-05-06 08:16:20
合計ジャッジ時間 6,405 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,096 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
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 85 ms
77,056 KB
testcase_19 AC 65 ms
71,168 KB
testcase_20 AC 100 ms
77,568 KB
testcase_21 AC 64 ms
70,656 KB
testcase_22 AC 110 ms
77,724 KB
testcase_23 AC 114 ms
77,568 KB
testcase_24 AC 114 ms
77,844 KB
testcase_25 AC 112 ms
77,556 KB
testcase_26 AC 117 ms
77,496 KB
testcase_27 AC 110 ms
77,476 KB
testcase_28 AC 67 ms
74,292 KB
testcase_29 AC 67 ms
74,496 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]
  if (A[X] in B)and(A[X]>0):
    for j in range(N):
      if A[X]==B[j]:
        ANS.append((2,X,j))
        B[j]=0
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