結果

問題 No.3234 Infinite Propagation
ユーザー miya145592
提出日時 2025-08-15 23:33:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 91,484 KB
最終ジャッジ日時 2025-08-15 23:33:55
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
T = int(input())
INF = 10**9
for _ in range(T):
    N = int(input())
    XY = [input().split() for _ in range(N)]
    flag = False
    Y = 0
    X = INF
    for x, y in XY:
        if x=="a":
            if "a" in y:
                flag = True
                break
            else:
                if Y<len(y):
                    Y = len(y)
        else:
            if "a" not in x:
                if X>len(x):
                    X = len(x)
    if flag:
        print("Yes")
        continue
    
    if Y>=X:
        print("Yes")
    else:
        print("No")
0