結果

問題 No.2283 Prohibit Three Consecutive
ユーザー 👑 p-adicp-adic
提出日時 2023-06-05 13:11:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 264 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 12,296 KB
最終ジャッジ日時 2023-08-28 09:31:00
合計ジャッジ時間 5,073 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,296 KB
testcase_01 AC 16 ms
7,828 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 236 ms
8,292 KB
testcase_04 AC 297 ms
8,368 KB
testcase_05 AC 343 ms
7,788 KB
testcase_06 AC 346 ms
7,820 KB
testcase_07 AC 15 ms
7,832 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