結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー siganaisiganai
提出日時 2022-04-09 17:20:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,160 bytes
コンパイル時間 1,038 ms
コンパイル使用メモリ 86,712 KB
実行使用メモリ 85,412 KB
最終ジャッジ日時 2023-08-19 21:20:08
合計ジャッジ時間 15,710 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
78,892 KB
testcase_01 AC 146 ms
78,748 KB
testcase_02 AC 144 ms
78,972 KB
testcase_03 WA -
testcase_04 AC 237 ms
84,252 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 252 ms
84,936 KB
testcase_09 AC 251 ms
84,588 KB
testcase_10 AC 257 ms
85,044 KB
testcase_11 AC 247 ms
84,740 KB
testcase_12 AC 258 ms
84,568 KB
testcase_13 AC 282 ms
85,044 KB
testcase_14 AC 277 ms
85,064 KB
testcase_15 AC 267 ms
84,876 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 197 ms
81,956 KB
testcase_19 AC 179 ms
81,376 KB
testcase_20 AC 219 ms
82,720 KB
testcase_21 AC 186 ms
82,180 KB
testcase_22 AC 227 ms
83,400 KB
testcase_23 AC 232 ms
83,780 KB
testcase_24 AC 233 ms
84,072 KB
testcase_25 AC 235 ms
83,524 KB
testcase_26 AC 229 ms
83,840 KB
testcase_27 AC 227 ms
83,444 KB
testcase_28 AC 244 ms
83,476 KB
testcase_29 AC 246 ms
83,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
import heapq
import functools
mod=10**9+7

import sys
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
heapa = []
b=list(map(int,input().split()))
heapb = []
for i in range(n):
    heapa.append([-a[i],i+1])
    heapb.append([b[i],i+1])
heapq.heapify(heapa)
heapq.heapify(heapb)
ans = []
cnt = 0
while True:
    maa,aind = heapq.heappop(heapa)
    maa = -maa
    mib,bind = heapq.heappop(heapb)
    #print(maa,mib)
    if maa < mib:
        break
    if maa == mib:
        ans.append([1,aind,bind])
        #a[aind-1] ^= b[bind-1]
        heapq.heappush(heapa,[0,aind])
        heapq.heappush(heapb,[maa,bind])       
    else:
        ans.append([1,aind,bind])
        #a[aind-1] ^= b[bind-1]
        ans.append([2,aind,bind])
        #b[bind-1] ^= a[aind-1]
        ans.append([1,aind,bind])
        #a[aind-1] ^= b[bind-1]
        heapq.heappush(heapa,[-mib,aind])
        heapq.heappush(heapb,[maa,bind])  
print(len(ans))
for row in ans:
    print(*row)
    
0