{"problem":{"name":"[PA 2022] Ornitolog 2","description":{"content":"**题目译自 [PA 2022](https://sio2.mimuw.edu.pl/c/pa-2022-1/dashboard/) Runda 1 [Ornitolog 2](https://sio2.mimuw.edu.pl/c/pa-2022-1/p/orn/)** 交替鹡鸰（*Motacilla alterna*）是鹡鸰属的一种鸟类。它因其独特的鸟鸣而与众不同，这种鸟的鸟鸣中，连续的音高","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P2"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9253"},"statements":[{"statement_type":"Markdown","content":"**题目译自 [PA 2022](https://sio2.mimuw.edu.pl/c/pa-2022-1/dashboard/) Runda 1 [Ornitolog 2](https://sio2.mimuw.edu.pl/c/pa-2022-1/p/orn/)**\n\n交替鹡鸰（*Motacilla alterna*）是鹡鸰属的一种鸟类。它因其独特的鸟鸣而与众不同，这种鸟的鸟鸣中，连续的音高交替地增加和减少。例如，如果我们用整数来表示音高，那么，鸟鸣可以是 $[2, 1, 3]$ 和 $[4, 5, -6, -5]$，但不能是 $[1, 2, 3, 2]$ 或 $[6, 5, 5, 4]$。为了记录这种迷人的生物，鸟类学家 Byteasar 将他的录音笔留在森林中数天。他现在想知道录到的声音是否与鹡鸰的鸟鸣相似。\n\n写一个程序，给定音高序列，确定最少将音高序列中多少个整数改成 $[-10^9,10^9]$ 区间内的任意整数，才能使得这个序列成为交替鹡鸰鸟鸣的音高序列。\n\n## Input\n\n第一行一个整数 $n$，表示这个音高序列的长度。\n\n第二行 $n$ 个整数 $a_1,a_2,\\ldots,a_n$，表示这个音高序列。\n\n## Output\n\n输出最少要修改多少整数才能使这个序列成为交替鹡鸰鸟鸣的音高序列。\n\n[samples]\n\n## Note\n\n对于 $100\\%$ 的数据，满足：\n\n$3\\le n\\le 5 \\times 10^4, -10^6\\le a_i\\le 10^6$。","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9253","tags":["2022","PA（波兰）"],"sample_group":[["5\n4 1 3 3 1\n","1"],["4\n-1000000 -1000000 -1000000 -1000000\n","2"]],"created_at":"2026-03-03 11:09:25"}}