結果
問題 |
No.1922 Separate and Attach
|
ユーザー |
|
提出日時 | 2023-01-10 22:07:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 117 ms / 2,000 ms |
コード長 | 344 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,004 KB |
実行使用メモリ | 112,440 KB |
最終ジャッジ日時 | 2024-12-21 12:22:37 |
合計ジャッジ時間 | 5,976 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 55 |
ソースコード
N = int(input()) B = list(map(int,input().split())) A = 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)