結果

問題 No.683 Two Operations No.3
ユーザー yuruhiyayuruhiya
提出日時 2020-07-02 22:02:27
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 464 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 11,432 KB
実行使用メモリ 23,316 KB
最終ジャッジ日時 2023-10-13 09:20:59
合計ジャッジ時間 2,700 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,092 KB
testcase_01 AC 92 ms
15,124 KB
testcase_02 AC 84 ms
15,276 KB
testcase_03 AC 84 ms
15,152 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 84 ms
15,160 KB
testcase_08 RE -
testcase_09 AC 83 ms
15,120 KB
testcase_10 AC 83 ms
15,224 KB
testcase_11 AC 82 ms
15,268 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 83 ms
15,156 KB
testcase_15 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a, b = gets.split.map &:to_i
hash = Hash.new { |hash, key|
  n, m = key
  if n < 0 || m < 0
    hash[key] = false
  elsif n == 0 && m == 0
    hash[key] = true
  elsif n % 2 == 1 && m % 2 == 1
    hash[key] = false
  elsif n % 2 == 0 && m % 2 == 1
    hash[key] = hash[[n / 2, m - 1]]
  elsif n % 2 == 1 && m % 2 == 0
    hash[key] = hash[[n - 1, m / 2]]
  else
    hash[key] = hash[[n - 1, m / 2]] || hash[[n / 2, m - 1]]
  end
}
puts hash[[a, b]] ? "Yes" : "No"
0