結果
問題 | No.1896 Arrays and XOR Procedure 2 |
ユーザー | siganai |
提出日時 | 2022-04-09 17:30:14 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,416 bytes |
コンパイル時間 | 422 ms |
コンパイル使用メモリ | 86,884 KB |
実行使用メモリ | 84,532 KB |
最終ジャッジ日時 | 2023-08-19 21:31:56 |
合計ジャッジ時間 | 14,269 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 148 ms
78,764 KB |
testcase_01 | AC | 148 ms
78,968 KB |
testcase_02 | AC | 145 ms
78,784 KB |
testcase_03 | AC | 258 ms
83,076 KB |
testcase_04 | AC | 241 ms
83,196 KB |
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 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 249 ms
83,188 KB |
testcase_29 | AC | 247 ms
83,588 KB |
ソースコード
#!/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: xor = maa ^ mib if xor > maa: ans.append([2,aind,bind]) heapq.heappush(heapa,[maa,aind]) heapq.heappush(heapb,[xor,bind]) elif xor < mib: ans.append([1,aind,bind]) heapq.heappush(heapa,[xor,aind]) heapq.heappush(heapb,[mib,bind]) else: ans.append([1,aind,bind]) ans.append([2,aind,bind]) heapq.heappush(heapa,[xor,aind]) heapq.heappush(heapb,[maa,bind]) print(len(ans)) for row in ans: print(*row)