結果

問題 No.305 鍵(2)
ユーザー simansiman
提出日時 2020-12-15 16:14:51
言語 Ruby
(3.3.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 31,528 KB
平均クエリ数 86.69
最終ジャッジ日時 2023-09-24 02:50:09
合計ジャッジ時間 2,720 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
31,000 KB
testcase_01 AC 106 ms
31,248 KB
testcase_02 AC 112 ms
31,528 KB
testcase_03 AC 109 ms
30,648 KB
testcase_04 AC 107 ms
31,292 KB
testcase_05 AC 107 ms
30,916 KB
testcase_06 AC 101 ms
30,756 KB
testcase_07 AC 106 ms
30,732 KB
testcase_08 AC 107 ms
31,276 KB
testcase_09 AC 105 ms
30,860 KB
testcase_10 AC 107 ms
30,644 KB
testcase_11 AC 109 ms
31,148 KB
testcase_12 AC 109 ms
30,988 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

numbers = Array.new(10, 0)

def query(x)
  STDOUT.puts(x)
  STDOUT.flush
  res = gets.chomp.split
  [res[0].to_i, res[1]]
end

10.times do |i|
  max_v = 0
  num = -1

  10.times do |n|
    numbers[i] = n
    v, status = query(numbers.join)

    if status == 'unlocked'
      exit
    end

    if max_v < v
      max_v = v
      num = n
    end
  end

  numbers[i] = num
end
0