結果

問題 No.2283 Prohibit Three Consecutive
ユーザー 👑 p-adicp-adic
提出日時 2023-06-05 12:57:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 265 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 13,132 KB
最終ジャッジ日時 2023-08-28 09:30:44
合計ジャッジ時間 6,304 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,316 KB
testcase_01 AC 16 ms
7,824 KB
testcase_02 AC 18 ms
7,800 KB
testcase_03 AC 512 ms
8,376 KB
testcase_04 AC 533 ms
8,360 KB
testcase_05 AC 660 ms
7,880 KB
testcase_06 AC 645 ms
7,968 KB
testcase_07 AC 15 ms
7,820 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

I=input
O='1'
for n in range(int(I())):
	N,S,f=I(),I(),0
	T=[[S,i][S[0]>O][:1]+[S,i][S[1]>O][1:2]for i in ["00","01","10","11"]]
	for t in T:
		a=b=c=d=1
		for s in t+S[2:]+t:a,b,c,d=c*(s!=O),(a+c)*(s>=O),(b+d)*(s!=O),b*(s>=O)
		f+=a+b+c+d
	print(["No","Yes"][f>0])
0