結果

問題 No.1805 Approaching Many Typhoon
ユーザー yudedakoyudedako
提出日時 2022-01-24 22:45:10
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 846 bytes
コンパイル時間 9,228 ms
コンパイル使用メモリ 262,536 KB
実行使用メモリ 63,376 KB
最終ジャッジ日時 2023-08-21 14:00:47
合計ジャッジ時間 49,566 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 978 ms
62,768 KB
testcase_01 AC 972 ms
62,624 KB
testcase_02 AC 969 ms
62,900 KB
testcase_03 AC 963 ms
62,536 KB
testcase_04 WA -
testcase_05 AC 957 ms
62,436 KB
testcase_06 AC 941 ms
62,444 KB
testcase_07 AC 961 ms
62,708 KB
testcase_08 AC 958 ms
62,372 KB
testcase_09 WA -
testcase_10 AC 936 ms
62,608 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 923 ms
62,572 KB
testcase_14 AC 986 ms
62,324 KB
testcase_15 WA -
testcase_16 AC 943 ms
62,344 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 928 ms
61,916 KB
testcase_21 AC 940 ms
62,268 KB
testcase_22 AC 928 ms
62,488 KB
testcase_23 AC 940 ms
62,392 KB
testcase_24 RE -
testcase_25 AC 928 ms
62,476 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 985 ms
62,760 KB
testcase_29 AC 984 ms
62,556 KB
testcase_30 AC 980 ms
62,860 KB
testcase_31 AC 1,011 ms
62,868 KB
testcase_32 AC 938 ms
62,852 KB
testcase_33 AC 955 ms
62,256 KB
testcase_34 AC 967 ms
62,596 KB
testcase_35 AC 988 ms
62,832 KB
testcase_36 AC 1,001 ms
63,016 KB
testcase_37 AC 951 ms
62,764 KB
testcase_38 AC 931 ms
62,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.collection.mutable
import scala.io.StdIn.*
import scala.math.min

@main def main =
  val Array(n, m) = readLine().split(' ').map(_.toInt)
  val Array(s, g) = readLine().split(' ').map(_.toInt - 1)
  val edges = Array.fill(m){
    val Array(f, t) = readLine().split(' ').map(_.toInt - 1)
    (f, t)
  }
  val graph = Array.fill(n){Nil: List[Int]}
  for (f, t) <- edges do
    graph(f) ::= t
  val u = readLine().toInt
  val closed = readLine().split(' ').map(_.toInt - 1)
  val visit = Array.fill(n){false}
  val stack = mutable.ArrayDeque[Int]().addOne(s)
  visit(s) = true
  for i <- closed do
    visit(i) = true
  while stack.nonEmpty do
    val current = stack.removeLast()
    for next <- graph(current) do
      if !visit(next) then
        visit(next) = true
        stack.addOne(next)
  println(if (visit(g)) "Yes" else "No")
0