結果

問題 No.3323 岩井星式ジャンケン
コンテスト
ユーザー tokugh
提出日時 2025-11-01 15:16:14
言語 Julia
(2.11.2)
結果
WA  
実行時間 -
コード長 1,169 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 7,720 KB
実行使用メモリ 240,528 KB
最終ジャッジ日時 2025-11-01 15:16:37
合計ジャッジ時間 23,123 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 12 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

toI(s=readline()) = parse(Int,s)
toVI(s=readline()) = map(toI,eachsplit(s))
rep(f,n) = [f() for _ in 1:n]
@enum YN Yes=1 No=0

function (@main)(ARGS)
    n,m = toVI()
    ss = rep(readline,n)
    solve(n,m,ss) |> println
    # join(stdout,solve()," "); println()
end

function solve(n,m,ss)
    ss = Set(ss)
    res = Char[]

    for i in 1:m
        g = c = p = 0
        for s in ss
            if s[i] == 'G'
                g += 1
            elseif s[i] == 'C'
                c += 1
            elseif s[i] == 'P'
                p += 1
            end
        end
        if g == c == 0
            push!(res,'C')
            return join(res)
        elseif c == p == 0
            push!(res,'P')
            return join(res)
        elseif p == g == 0
            push!(res,'G')
            return join(res)
        elseif g == 0
            push!(res,'C')
            filter!(s->first(s) != 'P',ss)
        elseif c == 0
            push!(res,'P')
            filter!(s->first(s) != 'G',ss)
        elseif p == 0
            push!(res,'G')
            filter!(s->first(s) != 'C',ss)
        else
            return "-1"
        end
    end
    return "-1"
end
0