#Lutece1864. backlight
backlight
Migrated from Lutece 1864 backlight
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
n (n <= 1000000) 人排成一列,每人朝左或朝右(0 表示朝左,1 表示朝右),起始他们全部站着,要让他们按某种顺序依次闭上眼睛并出列蹲下。每个人每看到另一个人出列蹲下,那么他 / 她就会产生 1 点焦虑值。设计一种闭眼顺序使得总焦虑值最小,求这个最小值。
Input
第一行一个 n,第二行 n 个数 (0 / 1)
Output
一行,一个数最小总焦虑值
Samples
5
0 0 0 1 0
1
5
1 0 1 0 1
3
Resources
每周一题 Div. 2