CF369A.Valera and Plates

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Valera is a lazy student. He has mm clean bowls and kk clean plates.

Valera has made an eating plan for the next nn days. As Valera is lazy, he will eat exactly one dish per day. At that, in order to eat a dish, he needs exactly one clean plate or bowl. We know that Valera can cook only two types of dishes. He can eat dishes of the first type from bowls and dishes of the second type from either bowls or plates.

When Valera finishes eating, he leaves a dirty plate/bowl behind. His life philosophy doesn't let him eat from dirty kitchenware. So sometimes he needs to wash his plate/bowl before eating. Find the minimum number of times Valera will need to wash a plate/bowl, if he acts optimally.

输入格式

The first line of the input contains three integers nn , mm , kk ( 1<=n,m,k<=10001<=n,m,k<=1000 ) — the number of the planned days, the number of clean bowls and the number of clean plates.

The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 1<=ai<=21<=a_{i}<=2 ). If aia_{i} equals one, then on day ii Valera will eat a first type dish. If aia_{i} equals two, then on day ii Valera will eat a second type dish.

输出格式

Print a single integer — the minimum number of times Valera will need to wash a plate/bowl.

输入输出样例

  • 输入#1

    3 1 1
    1 2 1
    

    输出#1

    1
    
  • 输入#2

    4 3 1
    1 1 1 1
    

    输出#2

    1
    
  • 输入#3

    3 1 2
    2 2 2
    

    输出#3

    0
    
  • 输入#4

    8 2 2
    1 2 1 2 1 2 1 2
    

    输出#4

    4
    

说明/提示

In the first sample Valera will wash a bowl only on the third day, so the answer is one.

In the second sample, Valera will have the first type of the dish during all four days, and since there are only three bowls, he will wash a bowl exactly once.

In the third sample, Valera will have the second type of dish for all three days, and as they can be eaten from either a plate or a bowl, he will never need to wash a plate/bowl.

首页