結果

問題 No.2283 Prohibit Three Consecutive
ユーザー Alex Wice
提出日時 2023-04-28 22:34:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 279 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-11-17 21:33:41
合計ジャッジ時間 1,603 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 2 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n, s):
	t = s + s
	if '111' in t or '000' in t:
		return False
	if '11?00' or '00?11' in t:
		return False
	if '11?0?11' or '00?1?00' in t:
		return False
	return True

for tc in range(int(input())):
	n = int(input())
	s = input()
	print("Yes" if solve(n, s) else "No")
0