結果

問題 No.3234 Infinite Propagation
ユーザー tokugh
提出日時 2025-08-15 22:27:05
言語 Julia
(2.11.2)
結果
AC  
実行時間 984 ms / 2,000 ms
コード長 801 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 7,844 KB
実行使用メモリ 263,752 KB
最終ジャッジ日時 2025-08-15 22:27:33
合計ジャッジ時間 18,048 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

function main()
    t = toI()
    for _ in 1:t
        n = toI()
        xys = rep(split∘readline,n)
        solve(n,xys) |> YN |> println
    end
end

function solve(n,xys)
    sort!(xys)
    mx = 0
    for (x,y) in xys
        if x == "a"
            if 'a' ∈ y
                return true
            else # y == "b...b" 
                mx = max(mx,length(y))
            end
        elseif 'a' ∉ x && length(x) ≤ mx # x == "b...b"
            if 'a' ∈ y
                return true
            else # y == "b...b"
                return true
            end
        end
    end
    return false
end

@static if endswith(@__FILE__, PROGRAM_FILE)
    main()
end
0