結果
問題 |
No.1922 Separate and Attach
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:01:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 540 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 130,176 KB |
最終ジャッジ日時 | 2025-06-12 17:01:58 |
合計ジャッジ時間 | 6,029 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 35 |
ソースコード
def main(): import sys input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr += 1 P = list(map(int, input[ptr:ptr+N])) ptr += N Q = list(map(int, input[ptr:ptr+N])) ptr += N pos_in_P = {num: i for i, num in enumerate(P)} blocks = 1 current_min = pos_in_P[Q[0]] for i in range(1, N): num = Q[i] pos = pos_in_P[num] if pos < current_min: blocks += 1 current_min = pos print(blocks - 1) if __name__ == "__main__": main()