結果

問題 No.2283 Prohibit Three Consecutive
ユーザー 👑 p-adicp-adic
提出日時 2023-06-05 11:41:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 208 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 8,424 KB
最終ジャッジ日時 2023-08-28 09:28:50
合計ジャッジ時間 2,778 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,800 KB
testcase_01 AC 16 ms
7,860 KB
testcase_02 AC 16 ms
7,804 KB
testcase_03 AC 94 ms
8,424 KB
testcase_04 AC 88 ms
8,132 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 328 ms
8,368 KB
testcase_09 AC 52 ms
8,232 KB
testcase_10 AC 54 ms
8,200 KB
testcase_11 AC 55 ms
8,356 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
T=int(I())
for t in R(T):
	N,S=I(),I()
	S+=S[0:2]
	a=b=c=d=1
	for s in S:
		if s>'1':a,b,c,d=c,a+c,b+d,b
		elif s<'1':a,b,c,d=c,0,b+d,0
		else:a,b,c,d=0,a+c,0,b
	print(["No","Yes"][a+b+c+d>0])
0