import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { private final static Main main = new Main(); public static void main(String[] args) { long l = System.currentTimeMillis(); main.answer(); //System.out.println("処理時間:" + (System.currentTimeMillis() - l)); } private void answer() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int c = sc.nextInt(); int v = sc.nextInt(); sc.nextLine(); String[] s = sc.nextLine().split(" "); String[] t = sc.nextLine().split(" "); String[] y = sc.nextLine().split(" "); String[] m = sc.nextLine().split(" "); sc.close(); Data[][] map = new Data[n][n]; for(int i=0; i queue = new LinkedList(); queue.add(new Data(0, 0, 0)); while(!queue.isEmpty()) { Data d = queue.poll(); int from = d.id; for(int to=0; to time[from] + map[from][to].time && c >= d.cost + map[from][to].cost) { time[to] = time[from] + map[from][to].time; queue.add(new Data(to, d.cost + map[from][to].cost, d.time)); } } } return time[g] == INF ? -1 : time[g]; } } private class Data { private int id; private int cost; private int time; private Data(int id, int cost, int time) { this.id = id; this.cost = cost; this.time = time; } } }