結果

問題 No.870 無敵囲い
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2019-10-27 01:54:00
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 11,404 KB
実行使用メモリ 15,328 KB
最終ジャッジ日時 2023-09-11 16:19:25
合計ジャッジ時間 2,804 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,144 KB
testcase_01 AC 82 ms
15,060 KB
testcase_02 AC 83 ms
15,252 KB
testcase_03 WA -
testcase_04 AC 81 ms
15,280 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 80 ms
15,228 KB
testcase_11 AC 81 ms
15,160 KB
testcase_12 AC 81 ms
15,028 KB
testcase_13 AC 82 ms
15,328 KB
testcase_14 AC 82 ms
15,060 KB
testcase_15 AC 81 ms
15,244 KB
testcase_16 AC 81 ms
15,240 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 80 ms
15,288 KB
testcase_20 AC 81 ms
15,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

muteki_gakoi_movement = {
  '7 9' => '6 8',
  '2 8' => '5 8',
  '3 9' => '4 8'
}

movement = {}
gets.to_i.times do
  x1, y1, x2, y2 = gets.split.map(&:to_i)
  movement[[x1, y1].join(' ')] = [x2, y2].join(' ')
end

puts muteki_gakoi_movement.all? { |start_p, end_p|
  before, current = nil, start_p
  while current = movement[current]
    break true if current == end_p
    break false if before == movement[current]

    before = current
  end
} ? 'YES' : 'NO'
0