結果

問題 No.1922 Separate and Attach
ユーザー rikein12
提出日時 2023-01-10 22:06:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 82,008 KB
実行使用メモリ 112,292 KB
最終ジャッジ日時 2024-12-21 12:22:30
合計ジャッジ時間 6,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

C = {a:i for i,a in enumerate(A)}

B = [C[b] for b in B]

now = set()
#print(B)
for b in B:
    if b-1 in now:
        now.add(b)
        now.remove(b-1)
    else:
        now.add(b)

n = len(now)
ans = 0
while n>1:
    n = (n+1)//2
    ans += 1
print(ans)
0