#K63837. Taco: Broadcast Signal
Taco: Broadcast Signal
Taco: Broadcast Signal
In this problem, you are given a network of routers connected by various links, each with a specified bandwidth usage. The task is to determine whether a communication signal can be broadcast from a source to all routers under a global maximum bandwidth constraint. Specifically, you are provided with the number of routers, a maximum bandwidth value (B), and a list of connections. Each connection is represented by a triplet ((u, v, w)), where (w) indicates the bandwidth used by that connection. The signal can be broadcast if and only if none of the connections exceed the bandwidth constraint (B).
inputFormat
The first line contains two integers (n) and (B) representing the number of routers and the maximum bandwidth constraint respectively. The second line contains an integer (m), the number of connections. Each of the following (m) lines contains three integers (u), (v), and (w) describing a connection between routers (u) and (v) with bandwidth usage (w).
outputFormat
Output a single line: print "YES" if every connection has a bandwidth usage not exceeding (B); otherwise, print "NO".## sample
4 5
3
1 2 3
2 3 4
2 4 5
YES