有 n 件T恤.第 i 件T恤的价格为 pi .每个T恤有两面,第 i 件T恤正面颜色为 ai ,反面颜色为 bi . 有 m 个人想买T恤,每个人都恰好买一件.第 j 个人最喜欢颜色 cj. 一个人会选择买一件至少有一面颜色为他喜欢的颜色的,最便宜的T恤.如果没有合法的T恤,则不买.这些人按照给定的顺序来购买. 你的任务是求出每个人会花多少钱. Input 第一行包含一个整数 n (1 ≤ n ≤ 200 000) - 表示T恤的数量. 之后一行为 p1, p2, ..., pn (1 ≤ p…
BUYING FEED 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 Farmer John needs to travel to town to pick up K (1 <= K <= 100)pounds of feed. Driving D miles with K pounds of feed in his truck costs D*K cents. The county feed lot has N (1 <= N<= 100) s…
Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is a lamp in a block, it will light it’s block and the direct adjacent blocks. For example, if there is a lamp at block 3, it will light the blocks 2, 3…