P3006 [USACO11JAN] Bottleneck G

Description

Farmer John is gathering the cows. His farm contains a network of N (1

Input Format

\* Line 1: Two space-separated integers: N and K \* Lines 2..N: Line i (not i+1) describes field i with three space-separated integers: P\_i, C\_i, and M\_i \* Lines N+1..N+K: Line N+i contains a single integer: T\_i

Output Format

\* Lines 1..K: Line i contains a single integer that is the maximum number of cows that can arrive at field 1 by time T\_i.