結果

問題 No.2283 Prohibit Three Consecutive
ユーザー Alex WiceAlex Wice
提出日時 2023-04-28 22:34:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 279 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 77,384 KB
最終ジャッジ日時 2024-04-29 00:02:22
合計ジャッジ時間 1,891 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 40 ms
52,352 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 42 ms
52,352 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

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