P1607 [USACO09FEB] Fair Shuttle G

题目描述

Although Farmer John has no problems walking around the fair to collect prizes or see the shows, his cows are not in such good shape; a full day of walking around the fair leaves them exhausted. To help them enjoy the fair, FJ has arranged for a shuttle truck to take the cows from place to place in the fairgrounds. FJ couldn't afford a really great shuttle, so the shuttle he rented traverses its route only once (!) and makes N (1

输入格式

输出格式

说明/提示

【样例说明】 班车可以把 $2$ 头奶牛从 $1$ 送到 $5$,$3$ 头奶牛从 $5$ 送到 $8$,$2$ 头奶牛从 $8$ 送到 $14$,$1$ 头奶牛从 $9$ 送到 $12$,$1$ 头奶牛从 $13$ 送到 $14$,$1$ 头奶牛从 $14$ 送到 $15$。