結果

問題 No.355 数当てゲーム(2)
ユーザー maimai
提出日時 2017-04-30 12:49:45
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 11,256 KB
実行使用メモリ 32,220 KB
平均クエリ数 4.88
最終ジャッジ日時 2023-09-23 13:15:10
合計ジャッジ時間 12,373 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 102 ms
31,400 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 105 ms
31,240 KB
testcase_05 AC 106 ms
31,568 KB
testcase_06 WA -
testcase_07 AC 110 ms
31,796 KB
testcase_08 WA -
testcase_09 AC 103 ms
31,516 KB
testcase_10 WA -
testcase_11 AC 108 ms
31,988 KB
testcase_12 WA -
testcase_13 AC 104 ms
32,220 KB
testcase_14 AC 106 ms
32,016 KB
testcase_15 WA -
testcase_16 AC 99 ms
31,448 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 101 ms
31,840 KB
testcase_20 AC 97 ms
31,828 KB
testcase_21 AC 107 ms
31,636 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 103 ms
31,924 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 103 ms
31,592 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 97 ms
31,484 KB
testcase_38 AC 102 ms
32,108 KB
testcase_39 AC 101 ms
31,884 KB
testcase_40 WA -
testcase_41 AC 101 ms
31,720 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 106 ms
31,208 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

answer = []
(0..9).to_a.combination(4){|_v|
    _v.permutation{|v|
        answer << v
    }
}

def simulate(answer,query)
    x=y=0
    4.times{|i|
        if answer[i] == query[i]
            x+=1
        elsif answer.include?(query[i])
            y+=1
        end
    }
    return [x,y]
end

while answer.size > 1
    v = answer.sample
    puts v*" " ; STDOUT.flush
    res = gets.split.map(&:to_i)
    answer.delete_if{|e| simulate(e,v) != res}
end
0