CSES - Flight Discount
Author: Kai Wang
Say I use the discount coupon on the edge between cities A and B.
There are two cases: I can go from , or . We need to know the distance between and , and and .
We can use Dijkstra's to compute the distance from and to every vertex. Then our answer is , where is the cost to travel from city A to city B after applying the coupon to that flight.
import java.io.*;import java.util.*;public class FlightDiscount {/*** Author : Kai Wang*/static class Pair implements Comparable<Pair>{int v; long w;