結果

問題 No.513 宝探し2
ユーザー smz_8110smz_8110
提出日時 2018-06-06 14:17:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 11,304 KB
実行使用メモリ 31,416 KB
平均クエリ数 15.00
最終ジャッジ日時 2023-09-24 01:48:07
合計ジャッジ時間 2,919 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
31,292 KB
testcase_01 AC 100 ms
31,372 KB
testcase_02 AC 98 ms
30,896 KB
testcase_03 AC 102 ms
31,416 KB
testcase_04 AC 98 ms
30,956 KB
testcase_05 AC 95 ms
31,112 KB
testcase_06 AC 96 ms
31,216 KB
testcase_07 AC 103 ms
31,116 KB
testcase_08 AC 101 ms
30,856 KB
testcase_09 AC 96 ms
31,276 KB
testcase_10 AC 102 ms
30,832 KB
testcase_11 AC 98 ms
31,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

puts "0 0"
$>.flush
s=[0,x=gets.to_i]
exit if x==0
puts "100000 0"
$>.flush
e=[100000,x=gets.to_i]
exit if x==0

while s[0]+1<e[0]
  n=(s[0]+e[0])/2
  puts "#{n} 0"
  $>.flush
  x=gets.to_i
  exit if x==0
  if s[1]<e[1]
    e=[n,x]
  else
    s=[n,x]
  end
end
if s[1]<e[1]
  puts s*" "
else
  puts e*" "
end
0