結果
問題 |
No.92 逃走経路
|
ユーザー |
![]() |
提出日時 | 2021-05-18 11:14:12 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,517 bytes |
コンパイル時間 | 2,021 ms |
コンパイル使用メモリ | 107,648 KB |
実行使用メモリ | 23,808 KB |
最終ジャッジ日時 | 2024-10-08 08:51:04 |
合計ジャッジ時間 | 3,091 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 WA * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq; using System.Collections.Generic; using System; public struct P { public int from { get; set; } public int fee { get; set; } } public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var m = int.Parse(line[1]); var k = int.Parse(line[2]); var d = new Dictionary<P, int>(); for (int i = 0; i < m; i++) { line = Console.ReadLine().Trim().Split(' '); var a = int.Parse(line[0]); var b = int.Parse(line[1]); var c = int.Parse(line[2]); var p0 = new P { from = a, fee = c }; var p1 = new P { from = b, fee = c }; d[p0] = b; d[p1] = a; } getAns(n, d); } static void getAns ( int n, Dictionary<P,int> d) { string[] line = Console.ReadLine().Trim().Split(' '); var k = Array.ConvertAll(line, int.Parse); var ans = Enumerable.Range(1, n).ToList(); var ans2 = new List<int>(); foreach(var x in k) { foreach(var y in ans) { var p = new P { from = y, fee = x }; if (d.ContainsKey(p)) ans2.Add(d[p]); } ans.Clear(); foreach (var y in ans2) ans.Add(y); ans2.Clear(); } ans.Sort(); Console.WriteLine(ans.Count()); Console.WriteLine(string.Join(" ",ans)); } }