結果
| 問題 |
No.1922 Separate and Attach
|
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:39:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 540 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 81,840 KB |
| 実行使用メモリ | 130,396 KB |
| 最終ジャッジ日時 | 2025-06-12 21:43:36 |
| 合計ジャッジ時間 | 5,724 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / 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()
gew1fw