結果

問題 No.629 グラフの中に眠る門松列
ユーザー letrangerjpletrangerjp
提出日時 2018-01-05 21:47:41
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 16,188 KB
最終ジャッジ日時 2023-08-24 20:38:25
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,152 KB
testcase_01 WA -
testcase_02 AC 78 ms
15,152 KB
testcase_03 AC 77 ms
15,136 KB
testcase_04 AC 78 ms
15,168 KB
testcase_05 AC 77 ms
15,096 KB
testcase_06 AC 80 ms
15,028 KB
testcase_07 AC 79 ms
15,036 KB
testcase_08 AC 79 ms
15,180 KB
testcase_09 AC 80 ms
15,132 KB
testcase_10 AC 77 ms
15,108 KB
testcase_11 AC 77 ms
15,080 KB
testcase_12 AC 77 ms
15,076 KB
testcase_13 AC 76 ms
15,216 KB
testcase_14 WA -
testcase_15 AC 77 ms
15,204 KB
testcase_16 AC 77 ms
15,204 KB
testcase_17 AC 78 ms
15,124 KB
testcase_18 AC 78 ms
15,120 KB
testcase_19 AC 78 ms
15,176 KB
testcase_20 AC 77 ms
15,144 KB
testcase_21 WA -
testcase_22 AC 79 ms
15,116 KB
testcase_23 AC 80 ms
15,140 KB
testcase_24 AC 89 ms
15,644 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 170 ms
16,188 KB
testcase_28 WA -
testcase_29 AC 123 ms
15,908 KB
testcase_30 AC 90 ms
15,552 KB
testcase_31 AC 130 ms
15,848 KB
testcase_32 AC 130 ms
15,740 KB
testcase_33 WA -
testcase_34 AC 147 ms
16,000 KB
testcase_35 AC 133 ms
15,932 KB
testcase_36 AC 98 ms
15,616 KB
testcase_37 WA -
testcase_38 AC 97 ms
15,820 KB
testcase_39 AC 90 ms
15,460 KB
testcase_40 WA -
testcase_41 AC 107 ms
15,812 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M = gets.split.map &:to_i
a = gets.split.map &:to_i
edges = []
$<.map{|s|
  from, to = s.split.map(&:to_i).map &:pred
  edges << [from, to] << [to, from]
}
puts a.each_with_index.any?{|n, i|
  values = edges.select{|from, to| from == i}.map{|from, to| a[to]}
  next if values.size < 2
  values.min(2).all?{|min| min < n} || values.max(2).all?{|max| max > n}
} ? :YES : :NO
0