結果
| 問題 | No.92 逃走経路 |
| コンテスト | |
| ユーザー |
ぴろず
|
| 提出日時 | 2014-12-07 19:40:42 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,756 bytes |
| 記録 | |
| コンパイル時間 | 28 ms |
| 最終ジャッジ日時 | 2026-03-04 21:47:28 |
| 合計ジャッジ時間 | 336 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
e5b5edd9ad2b
[/j_bin/judge_tool judge 40000 CompileMemory.txt /dev/null sud /dev/null _ python3 java_util.py code Main.java java]
strconv.Atoi: parsing "CompileMemory.txt": invalid syntax
goroutine 1 [running]:
runtime/debug.Stack()
/home/yuki2006/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.linux-amd64/src/runtime/debug/stack.go:26 +0x5e
main.main.func1()
/home/yuki2006/gopath/src/yukicoder/judge/main.go:22 +0x57
panic({0x7d6880?, 0xc0000f6210?})
/home/yuki2006/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.linux-amd64/src/runtime/panic.go:783 +0x132
main.judgeMain({0xc000012100, 0x5?, 0x0?})
/home/yuki2006/gopath/src/yukicoder/judge/judge_linux.go:121 +0x4b1
main.main()
/home/yuki2006/gopath/src/yukicoder/judge/main.go:97 +0x277
ソースコード
package no092;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int k = sc.nextInt();
Graph g = new Graph(n);
for(int i=0;i<m;i++) {
g.addBidirectionalEdge(sc.nextInt()-1, sc.nextInt()-1, sc.nextInt());
}
int[] d = new int[k];
for(int i=0;i<k;i++) {
d[i] = sc.nextInt();
}
boolean[][] dp = new boolean[k+1][n];
Arrays.fill(dp[0], true);
for(int i=0;i<k;i++) {
for(int v=0;v<n;v++) {
if (!dp[i][v]) {
continue;
}
for(Graph.Edge e:g.graph[v]) {
if (e.cost == d[i]) {
dp[i+1][e.to] = true;
}
}
}
}
ArrayList<Integer> ans = new ArrayList<>();
for(int i=0;i<n;i++) {
if (dp[k][i] == true) {
ans.add(i+1);
}
}
System.out.println(ans.size());
for(int i=0;i<ans.size();i++) {
if (i > 0) {
System.out.print(" ");
}
System.out.print(ans.get(i));
}
System.out.println();
}
}
class Graph {
public static final int INF = 1<<29;
int n;
ArrayList<Edge>[] graph;
@SuppressWarnings("unchecked")
public Graph(int n) {
this.n = n;
this.graph = new ArrayList[n];
for(int i=0;i<n;i++) {
graph[i] = new ArrayList<Edge>();
}
}
public void addBidirectionalEdge(int from,int to,int cost) {
addEdge(from,to,cost);
addEdge(to,from,cost);
}
public void addEdge(int from,int to,int cost) {
graph[from].add(new Edge(to, cost));
}
class Edge {
int to;
int cost;
public Edge(int to,int cost) {
this.to = to;
this.cost = cost;
}
}
}
ぴろず