結果

問題 No.683 Two Operations No.3
ユーザー yuruhiyayuruhiya
提出日時 2020-07-02 21:54:13
言語 Crystal
(1.11.2)
結果
MLE  
実行時間 -
コード長 502 bytes
コンパイル時間 17,460 ms
コンパイル使用メモリ 257,916 KB
実行使用メモリ 814,144 KB
最終ジャッジ日時 2023-09-13 10:58:20
合計ジャッジ時間 20,500 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,460 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,416 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = read_line.split.map &.to_i64
hash = Hash(Tuple(Int64, Int64), Bool).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