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]e.from){ prv[e.to]=e.from; } } } s=i; } // return d[j]; return prv; } void addEdge(int from,int to,long cost){ edges[from].add(new Edge(from,to,cost)); } } class Edge{ int from; int to; long cost; Edge(int i,int j,long cost){ this.from=i; this.to=j; this.cost=cost; } } class Vertice implements Comparable{ 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