結果

問題 No.305 鍵(2)
ユーザー gemmarogemmaro
提出日時 2020-08-05 07:37:18
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 667 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 11,224 KB
実行使用メモリ 31,908 KB
平均クエリ数 10.15
最終ジャッジ日時 2023-09-24 04:00:41
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 106 ms
31,076 KB
testcase_06 AC 90 ms
31,032 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

def unlocked?
  gets.split.then { |c, l| [c.to_i, l == 'unlocked'] }
end

cs = Array.new(10)
(0..9).each do |i|
  puts i.to_s * 10
  STDOUT.flush
  c, l = unlocked?
  if l
    exit
  else
    cs[i] = c.to_i
  end
end
es = Array.new(10)
(0..9).zip(cs).map do |i, c|
  (0..9).to_a.combination(c).each do |j|
    ds = Array.new(10, '*')
    j.each do |k|
      ds[k] = i
    end
    puts ds.join
    STDOUT.flush
    d, l = unlocked?
    if l
      exit
    else
      if c == d
        es[i] = j
        break
      end
    end
  end
end
xs = Array.new(10)
es.each_with_index do |e, j|
  e.each do |i|
    xs[i] = j
  end
end
puts xs.join
0