結果
問題 | No.355 数当てゲーム(2) |
ユーザー | honake |
提出日時 | 2016-10-19 20:25:23 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 918 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 11,576 KB |
実行使用メモリ | 31,632 KB |
平均クエリ数 | 17.69 |
最終ジャッジ日時 | 2023-09-23 11:40:44 |
合計ジャッジ時間 | 12,238 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 109 ms
31,348 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 105 ms
31,496 KB |
testcase_05 | AC | 104 ms
31,120 KB |
testcase_06 | AC | 106 ms
31,332 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 104 ms
30,984 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 104 ms
30,952 KB |
testcase_14 | AC | 106 ms
31,372 KB |
testcase_15 | WA | - |
testcase_16 | AC | 108 ms
31,332 KB |
testcase_17 | AC | 105 ms
30,704 KB |
testcase_18 | WA | - |
testcase_19 | AC | 103 ms
31,196 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 105 ms
31,460 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 105 ms
30,968 KB |
testcase_26 | WA | - |
testcase_27 | AC | 104 ms
30,684 KB |
testcase_28 | WA | - |
testcase_29 | AC | 105 ms
31,228 KB |
testcase_30 | AC | 102 ms
31,424 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 105 ms
30,832 KB |
testcase_34 | AC | 105 ms
30,972 KB |
testcase_35 | RE | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | AC | 105 ms
31,104 KB |
testcase_46 | WA | - |
testcase_47 | AC | 104 ms
31,548 KB |
testcase_48 | WA | - |
testcase_49 | AC | 105 ms
30,872 KB |
testcase_50 | WA | - |
testcase_51 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
def try(arr) $stdout.puts arr.join(' ') $stdout.flush x, y = gets.split.map(&:to_i) [x, y] end fst = 0 [2, 4, 6, 8].each do |i| fst += try([0, 1, i, i + 1]).reduce(:+) end if fst == 4 nums = [] sets = [[2, 3], [4, 5], [6, 7], [8, 9]] elsif fst == 7 nums = [] sets = [[2, 3], [4, 5], [6, 7], [8, 9]] elsif fst == 10 nums = [0, 1] sets = [[2, 3], [4, 5], [6, 7], [8, 9]] end 4.times do |i| arr = [sets[0][0], sets[1][0], sets[2][0], sets[3][0]] fb1 = try(arr).reduce(:+) arr[i] = sets[i][1] fb2 = try(arr).reduce(:+) if fb2 > fb1 nums.push(sets[i][1]) elsif fb2 < fb1 nums.push(sets[i][0]) end end if nums.size < 4 arr = [0, 2, 3, 4] fb1 = try(arr).reduce(:+) arr = [1, 2, 3, 4] fb2 = try(arr).reduce(:+) if fb2 > fb1 nums.push(1) elsif fb2 < fb1 nums.push(0) end end nums.permutation(4).each do |arr| res = try(arr) break if res == [4, 0] end