結果

問題 No.1465 Archaea
ユーザー 👑 obakyanobakyan
提出日時 2021-04-21 13:05:56
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 6,264 KB
最終ジャッジ日時 2023-09-17 09:27:58
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 21 ms
5,264 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 8 ms
4,376 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 AC 27 ms
6,264 KB
testcase_22 AC 28 ms
6,200 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, k = io.read("*n", "*n")
local len = {0}
for i = 2, n do
  len[i] = -1
end
local tasks = {1}
local done = 0
while done < #tasks do
  done = done + 1
  local src = tasks[done]
  if src + 3 <= n and len[src + 3] < 0 then
    len[src + 3] = len[src] + 3
    table.insert(tasks, src + 3)
  end
  if src * 2 <= n and len[src * 2] < 0 then
    len[src * 2] = len[src] + 1
    table.insert(tasks, src * 2)
  end
end
if len[n] < 0 or k < len[n] then
  print("NO")
else
  print("YES")
end
0