結果

問題 No.513 宝探し2
ユーザー simansiman
提出日時 2020-12-10 08:37:28
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 11,504 KB
実行使用メモリ 31,408 KB
平均クエリ数 63.42
最終ジャッジ日時 2023-09-24 09:19:27
合計ジャッジ時間 3,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 98 ms
31,300 KB
testcase_06 AC 101 ms
31,232 KB
testcase_07 AC 101 ms
31,020 KB
testcase_08 AC 100 ms
30,604 KB
testcase_09 AC 100 ms
30,832 KB
testcase_10 AC 104 ms
30,956 KB
testcase_11 AC 100 ms
30,920 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

cy = 0
cx = 0

STDOUT.puts("%d %d" % [cx, cy])
STDOUT.flush
current_d = gets.to_i

if current_d == 0
  exit
end

ok = 0
ng = 100_001

50.times do
  x = (ok + ng) / 2

  STDOUT.puts("%d %d" % [x, cy])
  STDOUT.flush
  d = gets.to_i

  if d == 0
    exit
  end

  if current_d >= d
    ok = x
    current_d = d
  else
    ng = x
  end
end

cx = ok
ok = 0
ng = 100_001

49.times do
  y = (ok + ng) / 2

  STDOUT.puts("%d %d" % [cx, y])
  STDOUT.flush
  d = gets.to_i

  if d == 0
    exit
  end

  if current_d >= d
    ok = y
    current_d = d
  else
    ng = y
  end
end
0