結果
問題 | No.334 門松ゲーム |
ユーザー |
|
提出日時 | 2016-01-16 00:07:19 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 541 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-09-19 19:39:47 |
合計ジャッジ時間 | 2,116 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 6 |
コンパイルメッセージ
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
ソースコード
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