結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー googol_S0googol_S0
提出日時 2022-04-08 22:43:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-05-06 08:21:58
合計ジャッジ時間 5,069 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
52,224 KB
testcase_02 WA -
testcase_03 OLE -
testcase_04 OLE -
testcase_05 OLE -
testcase_06 OLE -
testcase_07 OLE -
testcase_08 OLE -
testcase_09 OLE -
testcase_10 OLE -
testcase_11 OLE -
testcase_12 OLE -
testcase_13 OLE -
testcase_14 OLE -
testcase_15 OLE -
testcase_16 OLE -
testcase_17 OLE -
testcase_18 OLE -
testcase_19 WA -
testcase_20 OLE -
testcase_21 WA -
testcase_22 OLE -
testcase_23 OLE -
testcase_24 OLE -
testcase_25 OLE -
testcase_26 OLE -
testcase_27 OLE -
testcase_28 AC 164 ms
74,368 KB
testcase_29 AC 98 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+1,j+1))
        B[j]=0
  print(A,B)
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