A. 花坛

    Type: Default 1000ms 256MiB

花坛

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

问题说明

荔枝有一块长条形的花坛,里面种着一排N朵花。花有红色,黄色,白色两种。荔枝喜欢红花和黄花,不喜欢白花。请你摘走一个区间的花,使得其中有至少A个红花和B个黄花,并最小化白花的数量。

输入格式

第一行三个数字N, A, B。 第二行N个数字,表示花的颜色。0为白色,1为红色,2为黄色。

输出格式

一个数字表示最少需要摘下多少白花。

10 1 2
1 0 2 0 2 0 1 0 0 2
2

数据范围

对于20%的数据,n≤500。

对于再20%的数据,A=0。

对于再20%的数据,花坛中只有一朵红花。

对于100%的数据,n≤10^7, 保证答案存在。

第一实验寒假班小测验

Not Attended
Status
Done
Rule
IOI
Problem
3
Start at
2025-1-16 23:00
End at
2025-1-19 23:00
Duration
3 hour(s)
Host
Partic.
5