結果

問題 No.3234 Infinite Propagation
ユーザー sasa8uyauya
提出日時 2025-08-16 00:56:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,568 KB
実行使用メモリ 91,560 KB
最終ジャッジ日時 2025-08-16 00:56:54
合計ジャッジ時間 2,993 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for _ in range(T):
  n=int(input())
  p=[]
  for i in range(n):
    x,y=input().split()
    p+=[(x,y)]
  if all(x!="a" for x,y in p):
    print("No")
    continue
  if any("a" in y for x,y in p if x=="a"):
    print("Yes")
    continue
  b=max([len(y) for x,y in p if x=="a"]+[0])
  if b>=min([len(x) for x,y in p if "a" not in x]+[10**10]):
    print("Yes")
    continue
  print("No")
0