{"problem":{"name":"[JRKSJ R5] 1-1 A","description":{"content":"给出一个序列 $a$，$\\forall i\\in [1,n],a_i\\in \\{1,-1\\}$。 你可以将序列任意重排，需最小化重排后序列的最大子段和。","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":131072},"difficulty":{"LuoguStyle":"P2"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP8847"},"statements":[{"statement_type":"Markdown","content":"给出一个序列 $a$，$\\forall i\\in [1,n],a_i\\in \\{1,-1\\}$。\n\n你可以将序列任意重排，需最小化重排后序列的最大子段和。\n\n## Input\n\n第一行一个整数 $n$。\n\n第二行 $n$ 个整数表示 $a$。\n\n## Output\n\n一行 $n$ 个整数，以空格隔开，表示重排后的序列。\n\n若有多解，则任意输出一个答案即可。\n\n[samples]\n\n## Background\n\n本题是 1-1 的较易版本，较难版本为 [1-1 B](https://www.luogu.com.cn/problem/P8848)。\n\n## Note\n\n最大子段和的定义：序列中一段区间的和的最大值。即 $\\max_{1\\le l\\le r\\le n} \\sum_{i=l}^r a_i$。\n\n本题使用 $\\text{Special Judge}$，只要你的输出满足题意即可通过。\n\n**本题输入输出文件较大，请使用恰当的输入输出方式。**\n\n### 数据规模\n本题采用捆绑测试。\n\n| $\\text{Subtask}$ | $n\\le$ | $\\text{Score}$ |\n| :----------: | :----------: | :----------: |\n| $1$ | $10$ | $40$ |\n| $2$ | $10^6$ | $60$ |\n\n对于 $100\\%$ 的数据，$1\\le n\\le 10^6$，$a_i\\in \\{1,-1\\}$。","is_translate":false,"language":"English"}],"meta":{"iden":"LGP8847","tags":["2022","洛谷原创","Special Judge","构造","洛谷月赛"],"sample_group":[["4\n1 1 -1 -1","1 -1 -1 1"]],"created_at":"2026-03-03 11:09:25"}}