結果

問題 No.3234 Infinite Propagation
ユーザー ID 21712
提出日時 2025-08-31 01:55:13
言語 Go
(1.23.4)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 18,662 ms
コンパイル使用メモリ 234,688 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-31 01:55:34
合計ジャッジ時間 14,175 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import . "fmt"
import . "os"
import bf "bufio"
import . "strings"

func main() {
	rd:=bf.NewReader(Stdin)
	var t int
	Fscan(rd,&t)
	for ; t > 0; t-- {
		var n int
		Fscan(rd, &n)
		ok := false
		ab, bb := 0, int(3e5)
		for ; n > 0; n-- {
			var x,y string
			Fscan(rd,&x,&y)
			if "a" == x {
				if Contains(y, "a") {
					ok = true	
				} else {
					ab = max(ab, len(y))
				}
			} else if !Contains(x, "a") {
				bb = min(bb, len(x))
			}
		}
		if ok || bb <= ab {
			Println("Yes")
		} else {
			Println("No")
		}
	}
}
0