package yukicoder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.PriorityQueue; import java.util.Scanner; public class Main{ public static void main(String[] args)throws Exception{ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int s=sc.nextInt(); int g=sc.nextInt(); Dijkstra dj=new Dijkstra(n); for(int i=0;i[]edges; PriorityQueue pq; final long INF=Long.MAX_VALUE/4; Dijkstra(int n){ this.n=n; d=new long[n]; prv=new int[n]; Arrays.fill(prv, -1); @SuppressWarnings("unchecked") List[]edges=new List[n]; this.edges=edges; for(int i=0;i(); } s=-1; } int[] getShortestPath(int i,int j){ if(i!=s){ s=i; Arrays.fill(d, INF); d[i]=0; pq=new PriorityQueue(); pq.add(new Vertice(i,d[i])); while(!pq.isEmpty()){ Vertice u=pq.poll(); if(d[u.me]{ int me; long cost; Vertice(int me,long cost){ this.me=me; this.cost=cost; } @Override public int compareTo(Vertice o){ // return Long.compare(this.cost, o.cost); return this.cost>o.cost?1:this.costo.me?1:this.me