結果

問題 No.715 集合と二人ゲーム
コンテスト
ユーザー mai
提出日時 2018-07-13 23:11:14
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
WA  
実行時間 -
コード長 744 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 77 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 56,688 KB
最終ジャッジ日時 2026-04-25 08:30:10
合計ジャッジ時間 10,734 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29 WA * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

def ascan; gets.split.map(&:to_i); end
gets
aa = ascan.sort

lis = [1]
aa.each_cons(2) do |a,b|
    if (b-a).abs <= 1
        lis[-1] += 1
    else
        lis << 1
    end
end

hoge = lis.map{|e| x=e%20;x>8 ? (x-8)%6 : x%4 }.reduce(:^)
# p lis.map{|e| e%4}
puts hoge == 0 ? :Second : :First








#true => first
@memo = {}
def guchoku(set)
    return false if set.empty?
    return @memo[set] if @memo[set]
    set.each do |e|
        new_set = set.select{|x| (x-e).abs > 1}
        return @memo[set] = true if guchoku(new_set) == false
    end
    return @memo[set] = false
end

# 13.upto(13) do |i|
#     p [i+1, guchoku((1..(1+i)).to_a)]
# end
# 
# p guchoku(aa)

# 1 2 3 4 5 6 7 8 9
# t t t f t t t f t

# 0, 4, 8, 14, 20, 24, 28
# 4 6 6
0