結果

問題 No.629 グラフの中に眠る門松列
ユーザー letrangerjpletrangerjp
提出日時 2018-01-05 21:51:05
言語 Ruby
(3.3.0)
結果
AC  
実行時間 615 ms / 4,000 ms
コード長 390 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 11,332 KB
実行使用メモリ 19,208 KB
最終ジャッジ日時 2023-08-24 20:40:09
合計ジャッジ時間 9,286 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,040 KB
testcase_01 AC 80 ms
15,040 KB
testcase_02 AC 78 ms
15,152 KB
testcase_03 AC 78 ms
15,228 KB
testcase_04 AC 78 ms
15,228 KB
testcase_05 AC 77 ms
15,076 KB
testcase_06 AC 83 ms
15,264 KB
testcase_07 AC 81 ms
15,060 KB
testcase_08 AC 81 ms
15,176 KB
testcase_09 AC 83 ms
15,208 KB
testcase_10 AC 81 ms
15,272 KB
testcase_11 AC 81 ms
15,324 KB
testcase_12 AC 79 ms
15,144 KB
testcase_13 AC 77 ms
15,132 KB
testcase_14 AC 76 ms
15,136 KB
testcase_15 AC 77 ms
15,104 KB
testcase_16 AC 77 ms
15,080 KB
testcase_17 AC 78 ms
15,148 KB
testcase_18 AC 77 ms
15,148 KB
testcase_19 AC 78 ms
15,176 KB
testcase_20 AC 78 ms
15,228 KB
testcase_21 AC 217 ms
19,208 KB
testcase_22 AC 81 ms
15,224 KB
testcase_23 AC 81 ms
15,048 KB
testcase_24 AC 89 ms
15,692 KB
testcase_25 AC 140 ms
15,952 KB
testcase_26 AC 161 ms
16,008 KB
testcase_27 AC 278 ms
17,104 KB
testcase_28 AC 138 ms
19,100 KB
testcase_29 AC 128 ms
15,916 KB
testcase_30 AC 463 ms
18,136 KB
testcase_31 AC 494 ms
18,276 KB
testcase_32 AC 129 ms
16,012 KB
testcase_33 AC 615 ms
18,028 KB
testcase_34 AC 185 ms
16,476 KB
testcase_35 AC 133 ms
16,128 KB
testcase_36 AC 98 ms
15,660 KB
testcase_37 AC 449 ms
18,028 KB
testcase_38 AC 103 ms
15,484 KB
testcase_39 AC 144 ms
15,928 KB
testcase_40 AC 291 ms
19,188 KB
testcase_41 AC 110 ms
16,004 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]}
  values.uniq!
  next if values.size < 2
  values.min(2).all?{|min| min < n} || values.max(2).all?{|max| max > n}
} ? :YES : :NO
0