Figuring that they cannot do worse than the humans have, Farmer John's cows have decided to start an airline. Being cows, they decide to cater to the heretofore-untapped market of cows as passengers. They plan to serve the cows who live along the western coast of Lake Michigan. Each morning, they will fly from the northern-most point of the coast southward towards Chicowgo, making many stops along the way. Each evening, they will fly back north to the northern-most point. They need your help to decide which passengers to carry each day. Each of N (1 <= N <= 10,000) farms numbered 1..N along the coast contains an airport (Farm 1 is northern-most; farm N is southern-most). On this day, K (1 <= K <= 50,000) groups of cows wish to travel. Each group of cows wants to fly from a particular farm to another particular farm. The airline, if it wishes, is allowed to stop and pick up only part of a group. Cows that start a flight, however, must stay on the plane until they reach their destination. Given the capacity C (1 <= C <= 100) of the airplane and the groups of cows that want to travel, determine the maximum number of cows that the airline can fly to their destination.
为了表示不能输给人类,农场的奶牛们决定成立一家航空公司.她们计划每天早晨,从密歇根湖湖岸的最北端飞向最南端,晚上从最南端飞往最北端.在旅途中,航空公司可以安排飞机停在某些机场.他们需要你帮助来决定每天携带哪些旅客.沿着湖岸,有N(1≤N≤10000)个由北至南编号为1到N的农场.每个农场都有一个机场.这天,有k(l≤七≤50000)群牛想要乘坐飞机旅行.每一群牛想要从一个农场飞往另一个农场.航班可以在某些农场停下带上部分或全体的牛.奶牛们登机后会一直停留直至达到目的地 提供给你飞机的容量C(1≤C≤100),同时提供给你想要旅行的奶牛的信息,请你计算出这一天的航班最多能够满足几只奶牛的愿望.
4 8 3 1 3 2 2 8 3 4 7 1 8 3 2 INPUT DETAILS: Four groups of cows, eight farms, and three seats on the plane.
6
3群想要旅行的奶牛,8个农场,飞机上有3个座位.早晨,飞机把2只牛从1带到3,1只牛从2带到8,1只牛从4带到7.晚上,航班把2尺牛从8带到3.