結果

問題 No.2283 Prohibit Three Consecutive
ユーザー ShirotsumeShirotsume
提出日時 2023-04-28 23:33:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-04-29 00:40:28
合計ジャッジ時間 2,303 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,040 KB
testcase_01 AC 42 ms
55,552 KB
testcase_02 AC 41 ms
55,680 KB
testcase_03 AC 44 ms
56,448 KB
testcase_04 AC 44 ms
57,056 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 106 ms
65,664 KB
testcase_09 AC 109 ms
65,536 KB
testcase_10 AC 108 ms
65,664 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import random
def solve():
    n = ii()
    s = input()
    for i in range(50):
        x = i
        s = s[x:] + s[:x]
        if '000' in s or '111' in s or '00?11' in s or '11?00' in s:
            print('No')
            return
    print('Yes')


for _ in range(ii()):
    solve()
0