晚餐吃什么?AI (CI翻译)
In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are "relaxing".
在一个鲜为人知但非常美丽的国家——水之国,生活着一条可爱的鲨鱼 Valerie。和所有鲨鱼一样,她有好几排牙齿,以鲫鱼为食。Valerie 的一个显著特点是:每吃一条鲫鱼,她只使用其中一排牙齿,其余牙齿则处于“休息”状态。AI (CI翻译)
For a long time our heroine had been searching the sea for crucians, but a great misfortune happened. Her teeth started to ache, and she had to see the local dentist, lobster Ashot. As a professional, Ashot quickly relieved Valerie from her toothache. Moreover, he managed to determine the cause of Valerie's developing caries (for what he was later nicknamed Cap).
很长一段时间以来,我们的主人公一直在海里寻找鲫鱼,但一场大灾难发生了。她的牙齿开始疼痛,不得不去看当地的牙医——龙虾 Ashot。作为一名专业人士,Ashot 很快治好了 Valerie 的牙痛。此外,他还成功查明了 Valerie 患龋齿的原因(因此后来得到了 Cap 这个绰号)。AI (CI翻译)
It turned that Valerie eats too many crucians. To help Valerie avoid further reoccurrence of toothache, Ashot found for each Valerie's tooth its residual viability. Residual viability of a tooth is a value equal to the amount of crucians that Valerie can eat with this tooth. Every time Valerie eats a crucian, viability of all the teeth used for it will decrease by one. When the viability of at least one tooth becomes negative, the shark will have to see the dentist again.
原来,Valerie 吃了太多鲫鱼。为了帮助 Valerie 避免牙痛再次发生,Ashot 为 Valerie 的每颗牙齿确定了其剩余耐久度。牙齿的剩余耐久度是指 Valerie 可以用这颗牙齿吃掉的鲫鱼数量。每当 Valerie 吃掉一条鲫鱼时,用于进食的那一排中的所有牙齿的耐久度都会减少 $1$。当至少一颗牙齿的耐久度变为负数时,这条鲨鱼就必须再次去看牙医。AI (CI翻译)
Unhappy, Valerie came back home, where a portion of crucians was waiting for her. For sure, the shark couldn't say no to her favourite meal, but she had no desire to go back to the dentist. That's why she decided to eat the maximum amount of crucians from the portion but so that the viability of no tooth becomes negative.
Valerie 闷闷不乐地回到了家,此时一份鲫鱼正在等着她。当然,这条鲨鱼不可能拒绝自己最喜欢的食物,但她也不想再去看牙医。因此,她决定从这份鲫鱼中尽可能多地吃掉一些,同时保证没有任何牙齿的耐久度变为负数。AI (CI翻译)
As Valerie is not good at mathematics, she asked you to help her to find out the total amount of crucians that she can consume for dinner.
由于 Valerie 不擅长数学,她请你帮助她计算晚餐时总共可以吃掉多少条鲫鱼。AI (CI翻译)
We should remind you that while eating one crucian Valerie uses exactly one row of teeth and the viability of each tooth from this row decreases by one.
需要提醒的是,每吃一条鲫鱼,Valerie 恰好使用一排牙齿,并且这一排中的每颗牙齿的耐久度都会减少 $1$。AI (CI翻译)
Input
输入
AI (CI翻译)The first line contains three integers $*n*$, $*m*$, $*k*$ ($1 ≤ *m* ≤ *n* ≤ 1000, 0 ≤ *k* ≤ 10^{6}$) — total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow $*n*$ lines, each containing two integers: $*r*$ ($1 ≤ *r* ≤ *m*$) — index of the row, where belongs the corresponding tooth, and $*c*$ ($0 ≤ *c* ≤ 10^{6}$) — its residual viability.
第一行包含三个整数 $*n*$、$*m*$、$*k*$($1 ≤ *m* ≤ *n* ≤ 1000$,$0 ≤ *k* ≤ 10^{6}$)——Valerie 的牙齿总数、牙齿排数以及 Valerie 晚餐份额中的鲫鱼数量。接下来 $*n*$ 行,每行包含两个整数:$*r*$($1 ≤ *r* ≤ *m*$)——对应牙齿所属的牙齿排编号,以及 $*c*$($0 ≤ *c* ≤ 10^{6}$)——该牙齿的剩余耐久度。AI (CI翻译)
It's guaranteed that each tooth row has positive amount of teeth.
保证每一排牙齿都包含正数目的牙齿。AI (CI翻译)
Output
输出
AI (CI翻译)In the first line output the maximum amount of crucians that Valerie can consume for dinner.
第一行输出 Valerie 晚餐时最多可以吃掉的鲫鱼数量。AI (CI翻译)
样例
4 3 18
2 3
1 2
3 6
2 3
11
2 2 13
1 13
2 12
13
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。