結果

問題 No.1149 色塗りゲーム
ユーザー 👑 obakyanobakyan
提出日時 2021-05-24 15:50:32
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 24,340 KB
平均クエリ数 19.82
最終ジャッジ日時 2023-09-24 10:34:35
合計ジャッジ時間 5,560 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
24,328 KB
testcase_01 AC 36 ms
23,632 KB
testcase_02 AC 38 ms
23,632 KB
testcase_03 AC 35 ms
24,016 KB
testcase_04 AC 38 ms
23,992 KB
testcase_05 AC 38 ms
23,980 KB
testcase_06 AC 39 ms
24,304 KB
testcase_07 AC 39 ms
23,404 KB
testcase_08 AC 43 ms
23,500 KB
testcase_09 AC 38 ms
23,404 KB
testcase_10 AC 40 ms
24,004 KB
testcase_11 AC 40 ms
24,340 KB
testcase_12 AC 39 ms
24,052 KB
testcase_13 AC 39 ms
23,356 KB
testcase_14 AC 39 ms
23,512 KB
testcase_15 AC 38 ms
23,596 KB
testcase_16 AC 40 ms
24,232 KB
testcase_17 AC 42 ms
23,368 KB
testcase_18 AC 43 ms
23,620 KB
testcase_19 AC 42 ms
23,824 KB
testcase_20 AC 40 ms
23,992 KB
testcase_21 AC 42 ms
23,380 KB
testcase_22 AC 41 ms
24,004 KB
testcase_23 AC 41 ms
23,404 KB
testcase_24 AC 41 ms
23,380 KB
testcase_25 AC 43 ms
23,392 KB
testcase_26 AC 40 ms
24,268 KB
testcase_27 AC 41 ms
24,280 KB
testcase_28 AC 41 ms
23,512 KB
testcase_29 AC 44 ms
23,644 KB
testcase_30 AC 80 ms
24,208 KB
testcase_31 AC 72 ms
23,392 KB
testcase_32 AC 75 ms
23,416 KB
testcase_33 AC 79 ms
23,416 KB
testcase_34 AC 83 ms
23,548 KB
testcase_35 AC 79 ms
24,292 KB
testcase_36 AC 86 ms
23,968 KB
testcase_37 AC 88 ms
23,404 KB
testcase_38 AC 81 ms
24,292 KB
testcase_39 AC 87 ms
24,040 KB
testcase_40 AC 90 ms
24,016 KB
testcase_41 AC 88 ms
23,536 KB
testcase_42 AC 91 ms
23,644 KB
testcase_43 AC 90 ms
23,656 KB
testcase_44 AC 97 ms
23,392 KB
testcase_45 AC 96 ms
23,488 KB
testcase_46 AC 98 ms
24,028 KB
testcase_47 AC 104 ms
24,016 KB
testcase_48 AC 105 ms
24,016 KB
testcase_49 AC 107 ms
23,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local function query(k, x)
  io.write(k .. " " .. x .. "\n")
  io.flush()
  local ret = io.read("*l")
  return tonumber(ret)
end

local n = tonumber(io.read())
local z = 0
if n % 2 == 0 then
  z = query(2, math.floor(n / 2))
else
  z = query(1, math.ceil(n / 2))
end
while true do
  if z <= 1 then os.exit() end
  if z == 2 then io.read() os.exit() end
  local k, x = io.read():match("(%d+) (%d+)")
  k = tonumber(k)
  x = tonumber(x)
  if k == 1 then
    z = query(1, n + 1 - x)
  else
    z = query(2, n - x)
  end
end
0