{"problem":{"name":"Robot Arms 2","description":{"content":"You are given a sequence $A = (A_1, A_2, \\dots, A_N)$ of length $N$ consisting of positive integers, and integers $x$ and $y$.   Determine whether it is possible to place $N+1$ points $p_1, p_2, \\dots","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc274_d"},"statements":[{"statement_type":"Markdown","content":"You are given a sequence $A = (A_1, A_2, \\dots, A_N)$ of length $N$ consisting of positive integers, and integers $x$ and $y$.  \nDetermine whether it is possible to place $N+1$ points $p_1, p_2, \\dots, p_N, p_{N+1}$ in the $xy$\\-coordinate plane to satisfy all of the following conditions. (It is allowed to place two or more points at the same coordinates.)\n\n*   $p_1 = (0, 0)$.\n*   $p_2 = (A_1, 0)$.\n*   $p_{N+1} = (x, y)$.\n*   The distance between the points $p_i$ and $p_{i+1}$ is $A_i$. ($1 \\leq i \\leq N$)\n*   The segments $p_i p_{i+1}$ and $p_{i+1} p_{i+2}$ form a $90$ degree angle. ($1 \\leq i \\leq N - 1$)\n\n## Constraints\n\n*   $2 \\leq N \\leq 10^3$\n*   $1 \\leq A_i \\leq 10$\n*   $|x|, |y| \\leq 10^4$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $x$ $y$\n$A_1$ $A_2$ $\\dots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc274_d","tags":[],"sample_group":[["3 -1 1\n2 1 3","Yes\n\nThe figure below shows a placement where $p_1 = (0, 0)$, $p_2 = (2, 0)$, $p_3 = (2, 1)$, and $p_4 = (-1, 1)$. All conditions in the Problem Statement are satisfied.\n![image](https://img.atcoder.jp/ghi/9e66a2e8cd081f011d3baba22dbe64fa.jpg)"],["5 2 0\n2 2 2 2 2","Yes\n\nLetting $p_1 = (0, 0)$, $p_2 = (2, 0)$, $p_3 = (2, 2)$, $p_4 = (0, 2)$, $p_5 = (0, 0)$, and $p_6 = (2, 0)$ satisfies all the conditions. Note that multiple points may be placed at the same coordinates."],["4 5 5\n1 2 3 4","No"],["3 2 7\n2 7 4","No"],["10 8 -7\n6 10 4 1 5 9 8 6 5 1","Yes"]],"created_at":"2026-03-03 11:01:14"}}