結果

問題 No.1187 皇帝ペンギン
ユーザー 👑 obakyanobakyan
提出日時 2020-11-16 22:22:08
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 537 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 24,336 KB
平均クエリ数 17.15
最終ジャッジ日時 2023-09-24 07:08:29
合計ジャッジ時間 5,043 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,400 KB
testcase_01 AC 25 ms
23,452 KB
testcase_02 AC 25 ms
24,064 KB
testcase_03 AC 24 ms
24,052 KB
testcase_04 AC 24 ms
23,920 KB
testcase_05 AC 25 ms
23,992 KB
testcase_06 AC 25 ms
23,860 KB
testcase_07 AC 25 ms
24,328 KB
testcase_08 AC 26 ms
23,668 KB
testcase_09 AC 25 ms
23,500 KB
testcase_10 AC 24 ms
24,232 KB
testcase_11 AC 25 ms
23,412 KB
testcase_12 AC 25 ms
23,404 KB
testcase_13 AC 24 ms
24,052 KB
testcase_14 AC 25 ms
23,404 KB
testcase_15 AC 25 ms
23,980 KB
testcase_16 AC 24 ms
23,356 KB
testcase_17 AC 24 ms
23,488 KB
testcase_18 AC 25 ms
24,076 KB
testcase_19 AC 25 ms
24,280 KB
testcase_20 AC 24 ms
23,620 KB
testcase_21 AC 24 ms
23,512 KB
testcase_22 AC 25 ms
23,368 KB
testcase_23 AC 24 ms
23,860 KB
testcase_24 AC 25 ms
23,608 KB
testcase_25 AC 25 ms
23,800 KB
testcase_26 AC 23 ms
23,428 KB
testcase_27 AC 25 ms
23,332 KB
testcase_28 AC 25 ms
24,304 KB
testcase_29 AC 25 ms
23,344 KB
testcase_30 AC 25 ms
23,680 KB
testcase_31 AC 25 ms
24,316 KB
testcase_32 AC 25 ms
24,280 KB
testcase_33 AC 25 ms
24,268 KB
testcase_34 AC 25 ms
23,812 KB
testcase_35 AC 25 ms
23,992 KB
testcase_36 AC 25 ms
24,052 KB
testcase_37 AC 26 ms
23,404 KB
testcase_38 AC 25 ms
23,392 KB
testcase_39 AC 25 ms
23,416 KB
testcase_40 AC 25 ms
23,608 KB
testcase_41 AC 26 ms
23,416 KB
testcase_42 AC 25 ms
24,336 KB
testcase_43 AC 25 ms
23,508 KB
testcase_44 AC 24 ms
23,808 KB
testcase_45 AC 25 ms
23,580 KB
testcase_46 AC 24 ms
23,700 KB
testcase_47 AC 24 ms
23,404 KB
testcase_48 AC 25 ms
23,668 KB
testcase_49 AC 25 ms
23,416 KB
testcase_50 AC 27 ms
23,512 KB
testcase_51 AC 25 ms
24,316 KB
testcase_52 AC 25 ms
23,620 KB
testcase_53 AC 26 ms
24,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local function ask(num)
  io.write("? " .. num .. "\n")
  io.flush()
  local ret = io.read("*l")
  return ret == "safe"
end
local function ans(num)
  io.write("! " .. num .. "\n")
  io.flush()
  os.exit()
end

if not ask(1) then
  ans(0)
end

local left = 0
local right = 1000
local bls, brs = bit.lshift, bit.rshift
while 1 < right - left do
  local mid = brs(left + right, 1)
  local mid2 = mid + 1
  if ask(mid) then
    left = mid
  else
    if ask(mid2) then
      left = mid2
    else
      right = mid
    end
  end
end
ans(left)
0