結果

問題 No.334 門松ゲーム
ユーザー finefine
提出日時 2016-01-16 00:07:19
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 11,988 KB
実行使用メモリ 16,364 KB
最終ジャッジ日時 2023-10-19 23:46:56
合計ジャッジ時間 2,617 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
16,116 KB
testcase_01 AC 86 ms
16,116 KB
testcase_02 AC 98 ms
16,276 KB
testcase_03 AC 86 ms
16,116 KB
testcase_04 AC 86 ms
16,116 KB
testcase_05 AC 87 ms
16,116 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 94 ms
16,240 KB
testcase_10 AC 102 ms
16,288 KB
testcase_11 AC 98 ms
16,256 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 97 ms
16,260 KB
testcase_15 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:15: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:24: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

def kadomatsu original,array
    tmp = [original[array[0]],original[array[1]],original[array[2]]]
    if tmp.minmax == [tmp[0],tmp[2]].sort
        return false
    else
        return true
    end
end
    
n = gets.to_i 
k = gets.split.map(&:to_i)
range = [*0..n-1]
kado = range.combination(3).to_a.select{|a|kadomatsu(k,a)}
if kado.empty?
    puts -1
    exit
end
kado.each{|v|
    if ((range - v).combination(3).to_a.select{|a|kadomatsu(k,a)}.inject(&:|).to_a.size / 3) % 2 == 0
        puts v.join(' ')
        exit
    end
    }
puts -1
0