結果

問題 No.355 数当てゲーム(2)
ユーザー simansiman
提出日時 2021-06-14 11:23:42
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 523 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 11,476 KB
実行使用メモリ 31,736 KB
平均クエリ数 46.40
最終ジャッジ日時 2023-09-24 10:40:16
合計ジャッジ時間 9,295 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
31,068 KB
testcase_01 RE -
testcase_02 AC 99 ms
30,936 KB
testcase_03 AC 102 ms
31,020 KB
testcase_04 AC 105 ms
30,604 KB
testcase_05 RE -
testcase_06 AC 97 ms
30,840 KB
testcase_07 AC 100 ms
31,276 KB
testcase_08 AC 98 ms
31,380 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 103 ms
30,904 KB
testcase_12 AC 104 ms
31,496 KB
testcase_13 RE -
testcase_14 AC 95 ms
31,192 KB
testcase_15 AC 94 ms
31,280 KB
testcase_16 AC 94 ms
31,104 KB
testcase_17 AC 96 ms
31,352 KB
testcase_18 AC 100 ms
30,880 KB
testcase_19 AC 100 ms
30,612 KB
testcase_20 AC 94 ms
31,320 KB
testcase_21 AC 96 ms
31,664 KB
testcase_22 AC 97 ms
31,548 KB
testcase_23 AC 95 ms
31,516 KB
testcase_24 AC 94 ms
30,880 KB
testcase_25 AC 101 ms
30,888 KB
testcase_26 AC 99 ms
31,360 KB
testcase_27 AC 94 ms
31,560 KB
testcase_28 AC 98 ms
31,036 KB
testcase_29 AC 100 ms
30,936 KB
testcase_30 AC 97 ms
31,360 KB
testcase_31 AC 95 ms
30,908 KB
testcase_32 AC 98 ms
31,100 KB
testcase_33 AC 96 ms
30,824 KB
testcase_34 AC 99 ms
31,416 KB
testcase_35 AC 95 ms
30,704 KB
testcase_36 AC 98 ms
31,460 KB
testcase_37 AC 98 ms
31,164 KB
testcase_38 AC 93 ms
31,428 KB
testcase_39 AC 93 ms
31,052 KB
testcase_40 AC 102 ms
30,932 KB
testcase_41 AC 96 ms
30,744 KB
testcase_42 AC 97 ms
31,308 KB
testcase_43 AC 98 ms
30,688 KB
testcase_44 AC 99 ms
31,052 KB
testcase_45 AC 94 ms
31,128 KB
testcase_46 AC 99 ms
30,736 KB
testcase_47 AC 101 ms
31,372 KB
testcase_48 AC 99 ms
30,952 KB
testcase_49 AC 97 ms
31,040 KB
testcase_50 AC 99 ms
31,408 KB
testcase_51 AC 99 ms
31,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def send_query(nums)
  STDOUT.puts(nums.join(' '))
  STDOUT.flush
  a, b = gets.chomp.split.map(&:to_i)
  if a == 4
    exit 0
  end
  [a, b]
end

excepted_nums = []
nums = [*0..9]
nums.combination(4).each do |list|
  a, b = send_query(list)

  if a + b == 0
    excepted_nums = list.dup
    break
  end
end

cand = []

10.times do |i|
  next if excepted_nums.include?(i)
  excepted_nums[3] = i
  a, b = send_query(excepted_nums)

  if a + b > 0
    cand << i
  end
end

cand.permutation(4).each do |n|
  send_query(n)
end
0