結果
問題 | No.1896 Arrays and XOR Procedure 2 |
ユーザー | Hydru |
提出日時 | 2022-04-08 23:19:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 946 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 72,832 KB |
最終ジャッジ日時 | 2024-05-06 09:04:12 |
合計ジャッジ時間 | 5,997 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 64 ms
68,480 KB |
testcase_05 | AC | 67 ms
72,576 KB |
testcase_06 | WA | - |
testcase_07 | AC | 65 ms
68,608 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 71 ms
70,528 KB |
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 | 64 ms
68,096 KB |
testcase_29 | AC | 65 ms
68,480 KB |
ソースコード
from itertools import count N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) def max_ind(X): M=X[0] ind=0 for i in range(1,len(X)): if M<X[i]: M,ind=X[i],ind return M,ind max_A,ind_A = max_ind(A) max_B,ind_B = max_ind(B) def len_bit(N): val=1 count=0 while(val<=N): val*=2 count+=1 return count ans=[] if len_bit(max_A)>len_bit(max_B): ans.append("{} {} {}".format(2,ind_A+1,ind_B+1)) B[ind_B]^=max_A max_B^=max_A for i in range(N-1): if A[i]>=max_B: ans.append("{} {} {}".format(1,i+1,ind_B+1)) if len_bit(A[N-1])<len_bit(max_B): ans.append("{} {} {}".format(1,N,ind_B)) A[N-1]^=max_B max_A=A[N-1] for i in range(N): if i==ind_B: continue if B[i]<max_A: ans.append("{} {} {}".format(2,N,i+1)) ans.append("{} {} {}".format(1,N,ind_B+1)) print(len(ans)) for x in ans: print(x)