結果

問題 No.3234 Infinite Propagation
ユーザー Facade
提出日時 2025-08-16 12:34:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,968 KB
実行使用メモリ 87,188 KB
最終ジャッジ日時 2025-08-16 12:34:27
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
for _ in range(t):
    n=int(input())
    ok=False;
    x=[]
    y=[]
    for _ in range(n):
        xx,yy=input().split()
        x.append(xx)
        y.append(yy)
    ok2=False
    for i in range(n):
        if x[i]=='a':
            ok2=True
            if 'a' in y[i]:
                ok=True
    if ok:
        print("Yes")
        continue
    elif not ok2:
        print("No")
        continue
    mx=0
    mn=10**18
    for i in range(n):
        if x[i]=='a':
            mx=max(mx,len(y[i]))
        if 'a' not in x[i]:
            mn=min(mn,len(x[i]))
    if mx>=mn:
        print("Yes")
    else:
        print("No")
0