結果

問題 No.331 CodeRunnerでやれ
ユーザー simansiman
提出日時 2022-07-27 00:55:06
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 496 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 100,364 KB
平均クエリ数 71.94
最終ジャッジ日時 2023-09-24 03:05:06
合計ジャッジ時間 9,687 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
31,388 KB
testcase_01 AC 215 ms
30,920 KB
testcase_02 AC 235 ms
31,060 KB
testcase_03 AC 228 ms
30,840 KB
testcase_04 AC 232 ms
30,700 KB
testcase_05 AC 241 ms
30,924 KB
testcase_06 AC 257 ms
30,984 KB
testcase_07 AC 322 ms
31,224 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def send_query(str)
  STDOUT.puts(str)
  STDOUT.flush

  res = gets.chomp

  if res == "Merry Christmas!"
    -1
  else
    res.to_i
  end
end

v = gets.to_i
v.times do
  res = send_query("F")
  exit if res == -1
end

send_query("R")

loop do
  res = send_query("L")

  if res > 0
    f = send_query("F")

    if f < 0
      exit
    end
  else
    f = send_query("R")

    if f > 0
      r = send_query("F")
      if r < 0
        exit
      end
    else
      send_query("R")
    end
  end
end
0