Posts

Showing posts from September, 2018

POJ 3662: Telephone Lines

POJ 3662: Telephone Lines Problem Statement Telephone Lines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8989 Accepted: 3263 Description Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables required to connect his farm to the phone system. There are N (1 ≤ N ≤ 1,000) forlorn telephone poles conveniently numbered 1.. N that are scattered around Farmer John's property; no cables connect any them. A total of P (1 ≤ P ≤ 10,000) pairs of poles can be connected by a cable; the rest are too far apart. The i -th cable can connect the two distinct poles A i and B i , with length L i (1 ≤ L i ≤ 1,000,000) units if used. The input data set never names any { A i , B i } pair more than once. Pole 1 is already connected to the phone system, and pole N is at the farm. Poles 1 and N need to be connected by a path of cables; the rest of the poles might b