結果

問題 No.355 数当てゲーム(2)
ユーザー maimai
提出日時 2017-04-30 12:53:08
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 11,572 KB
実行使用メモリ 32,176 KB
平均クエリ数 4.87
最終ジャッジ日時 2023-09-23 13:14:55
合計ジャッジ時間 13,374 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 117 ms
32,156 KB
testcase_02 WA -
testcase_03 AC 115 ms
31,920 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 118 ms
31,876 KB
testcase_08 AC 104 ms
31,200 KB
testcase_09 WA -
testcase_10 AC 114 ms
31,640 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 116 ms
31,388 KB
testcase_17 AC 117 ms
31,664 KB
testcase_18 AC 117 ms
31,336 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 117 ms
31,920 KB
testcase_22 WA -
testcase_23 AC 115 ms
31,752 KB
testcase_24 WA -
testcase_25 AC 117 ms
31,940 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 101 ms
32,068 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 119 ms
31,924 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 101 ms
32,000 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 116 ms
32,032 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 115 ms
31,444 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 113 ms
31,784 KB
testcase_47 AC 116 ms
32,072 KB
testcase_48 WA -
testcase_49 AC 117 ms
31,436 KB
testcase_50 WA -
testcase_51 AC 103 ms
31,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

def send(v)
    puts v*" " ; STDOUT.flush
    return gets.split.map(&:to_i)
end

while answer.size > 1
    v = answer.sample
    res = send(v)
    answer.delete_if{|e| simulate(e,v) != res}
end

abort if answer.size == 0
0