{"raw_statement":[{"iden":"problem statement","content":"You are given a permutation $P=(P _ 1,P _ 2,\\ldots,P _ N)$ of $(1,2,\\ldots,N)$.\nFind the following value for all $i\\ (1\\leq i\\leq N)$:\n\n*   $D _ i=\\displaystyle\\min_{j\\neq i}\\left\\lparen\\left\\lvert P _ i-P _ j\\right\\rvert+\\left\\lvert i-j\\right\\rvert\\right\\rparen$.\n\nWhat is a permutation? A permutation of $(1,2,\\ldots,N)$ is a sequence that is obtained by rearranging $(1,2,\\ldots,N)$. In other words, a sequence $A$ of length $N$ is a permutation of $(1,2,\\ldots,N)$ if and only if each $i\\ (1\\leq i\\leq N)$ occurs in $A$ exactly once."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2\\times10^5$\n*   $1 \\leq P _ i \\leq N\\ (1\\leq i\\leq N)$\n*   $i\\neq j\\implies P _ i\\neq P _ j$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$P _ 1$ $P _ 2$ $\\ldots$ $P _ N$"},{"iden":"sample input 1","content":"4\n3 2 4 1"},{"iden":"sample output 1","content":"2 2 3 3 \n\nFor example, for $i=1$,\n\n*   if $j=2$, we have $\\left\\lvert P _ i-P _ j\\right\\rvert=1$ and $\\left\\lvert i-j\\right\\rvert=1$;\n*   if $j=3$, we have $\\left\\lvert P _ i-P _ j\\right\\rvert=1$ and $\\left\\lvert i-j\\right\\rvert=2$;\n*   if $j=4$, we have $\\left\\lvert P _ i-P _ j\\right\\rvert=2$ and $\\left\\lvert i-j\\right\\rvert=3$.\n\nThus, the value is minimum when $j=2$, where $\\left\\lvert P _ i-P _ j\\right\\rvert+\\left\\lvert i-j\\right\\rvert=2$, so $D _ 1=2$."},{"iden":"sample input 2","content":"7\n1 2 3 4 5 6 7"},{"iden":"sample output 2","content":"2 2 2 2 2 2 2"},{"iden":"sample input 3","content":"16\n12 10 7 14 8 3 11 13 2 5 6 16 4 1 15 9"},{"iden":"sample output 3","content":"3 3 3 5 3 4 3 3 4 2 2 4 4 4 4 7"}],"translated_statement":null,"sample_group":[],"show_order":["render_html"],"formal_statement":null,"simple_statement":null,"has_page_source":true}