{"problem":{"name":"Twice Subsequence","description":{"content":"There is a sequence $A = (A_1,\\dots,A_N)$. Determine whether there are at least two subsequences of $A$ that match the sequence $B = (B_1,\\dots,B_M)$. Two subsequences are distinguished if they are ta","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc195_a"},"statements":[{"statement_type":"Markdown","content":"There is a sequence $A = (A_1,\\dots,A_N)$. Determine whether there are at least two subsequences of $A$ that match the sequence $B = (B_1,\\dots,B_M)$. Two subsequences are distinguished if they are taken from different positions, even if they coincide as sequences.\nSubsequence A subsequence of $A$ is a sequence obtained by removing zero or more elements from $A$ and leaving the remaining elements in their original order.\n\n## Constraints\n\n*   $1 \\leq M \\leq N \\leq 2\\times 10^5$\n*   $1 \\leq A_i \\leq 10^9$\n*   $1 \\leq B_i \\leq 10^9$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $A_2$ $\\ldots$ $A_N$\n$B_1$ $B_2$ $\\ldots$ $B_M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc195_a","tags":[],"sample_group":[["4 2\n1 2 1 2\n1 2","Yes\n\nThere are three subsequences of $A$ that match $B$: $(A_1,A_2), (A_1,A_4), (A_3,A_4)$."],["3 2\n1 2 1\n1 2","No\n\nThere is only one subsequence of $A$ that matches $B$: $(A_1,A_2)$."],["3 2\n1 1 2\n2 1","No\n\nThere are no subsequences of $A$ that match $B$."]],"created_at":"2026-03-03 11:01:14"}}