結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー ikomaikoma
提出日時 2022-04-08 22:19:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 80,732 KB
最終ジャッジ日時 2023-08-19 00:49:07
合計ジャッジ時間 9,660 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,096 KB
testcase_01 AC 66 ms
71,352 KB
testcase_02 AC 66 ms
71,040 KB
testcase_03 AC 141 ms
79,304 KB
testcase_04 AC 135 ms
78,720 KB
testcase_05 AC 158 ms
80,324 KB
testcase_06 AC 134 ms
79,436 KB
testcase_07 AC 133 ms
78,752 KB
testcase_08 AC 167 ms
79,972 KB
testcase_09 AC 158 ms
80,464 KB
testcase_10 AC 164 ms
80,732 KB
testcase_11 AC 160 ms
80,024 KB
testcase_12 AC 159 ms
80,360 KB
testcase_13 AC 157 ms
79,384 KB
testcase_14 AC 150 ms
78,872 KB
testcase_15 AC 146 ms
79,136 KB
testcase_16 AC 143 ms
78,884 KB
testcase_17 AC 147 ms
79,324 KB
testcase_18 AC 119 ms
78,664 KB
testcase_19 AC 102 ms
78,100 KB
testcase_20 AC 137 ms
79,104 KB
testcase_21 AC 103 ms
77,452 KB
testcase_22 AC 136 ms
78,956 KB
testcase_23 AC 138 ms
79,608 KB
testcase_24 AC 139 ms
79,336 KB
testcase_25 AC 138 ms
79,392 KB
testcase_26 AC 135 ms
79,452 KB
testcase_27 AC 137 ms
78,824 KB
testcase_28 AC 127 ms
79,180 KB
testcase_29 AC 122 ms
78,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from heapq import *

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Ah = [(-a,i+1) for i,a in enumerate(A)]
Bh = [(b,i+1) for i,b in enumerate(B)]
heapify(Ah)
heapify(Bh)
i=10000
a,ia = heappop(Ah)
b,ib = heappop(Bh)
a = -a
ans = []
while i>0:
    if a<b:break
    i-=1
    ab = a^b
    if b==0 or b<ab:
        ans.append((2,ia,ib))
        heappush(Bh, (ab,ib))
        b,ib = heappop(Bh)
        continue
    else:
        ans.append((1,ia,ib))
        if ab>0:
            heappush(Ah, (-ab, ia))
        if len(Ah)==0:break
        a,ia = heappop(Ah)
        a = -a
print(len(ans))
for a in ans:
    print(*a)
0