{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eBaobao loves singing very much and he really enjoys a game called \u003ci\u003eSinging Everywhere\u003c/i\u003e, which allows players to sing and scores the players according to their performance.\u003c/p\u003e\n\n\u003cp\u003eConsider the song performed by Baobao as an integer sequence $a_1, a_2,\\dots,a_n$, where $a_i$ indicates the $i$-th note in the song. We say a note $a_k$ is a \"voice crack\" if $1 \u0026lt; k \u0026lt; n$, $a_{k-1} \u0026lt; a_k$ and $a_{k+1} \u0026lt; a_k$. The more voice cracks BaoBao sings, the lower score he gets.\u003c/p\u003e\n\n\u003cp\u003eTo get a higher score, BaoBao decides to delete at most one note in the song. What\u0027s the minimum number of times BaoBao sings a voice crack after this operation?\u003c/p\u003e\n\n\u003ch4\u003eInput\u003c/h4\u003e\n\u003cp\u003eThere are multiple test cases. The first line of the input contains an integer $T$ (about 100), indicating the number of test cases. For each test case:\u003c/p\u003e\n\n\u003cp\u003eThe first line contains one integer $n$ ($1 \\leq n \\leq 10^{5}$), indicating the length of the song.\u003c/p\u003e\n\n\u003cp\u003eThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($-2^{31} \\leq a_i \u0026lt; 2^{31}$), indicating the song performed by BaoBao.\u003c/p\u003e\n\n\u003cp\u003eIt\u0027s guaranteed that at most 5 test cases have $n \u0026gt; 100$.\u003c/p\u003e\n\n\u003ch4\u003eOutput\u003c/h4\u003e\n\u003cp\u003eFor each test case output one line containing one integer, indicating the answer.\u003c/p\u003e\n\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n6\n1 1 4 5 1 4\n7\n1 9 1 9 8 1 0\n10\n2 1 4 7 4 8 3 6 4 7\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n0\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003ch4\u003eHint\u003c/h4\u003e\n\u003cp\u003eFor the first sample test case, BaoBao does not need to delete a note. Because if he deletes no note, he will sing 1 voice crack (the 4th note), and no matter which note he deletes, he will also always sing 1 voice crack.\u003c/p\u003e\n\n\u003cp\u003eFor the second sample test case, BaoBao can delete the 3rd note, and no voice cracks will be performed. Yay!\u003c/p\u003e\n\n\u003cp\u003eFor the third sample test case, BaoBao can delete the 4th note, so that only 2 voice cracks will be performed (4 \u003cb\u003e8\u003c/b\u003e 3 and 3 \u003cb\u003e6\u003c/b\u003e 4).\u003c/p\u003e\n"}}]}