結果

問題 No.2283 Prohibit Three Consecutive
ユーザー okapinokapin
提出日時 2023-04-28 22:00:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 86,396 KB
最終ジャッジ日時 2024-04-28 23:36:16
合計ジャッジ時間 3,205 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,584 KB
testcase_01 AC 42 ms
51,840 KB
testcase_02 AC 42 ms
51,968 KB
testcase_03 AC 214 ms
86,396 KB
testcase_04 AC 211 ms
84,420 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 116 ms
85,348 KB
testcase_09 AC 123 ms
85,868 KB
testcase_10 AC 129 ms
85,316 KB
testcase_11 AC 130 ms
85,696 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    s = list(input())

    if len(s)>3:
        for i in range(n):
            if s[i%n:(i+3)%n]==['0','0','?']:
                s[((i+2)%n)]='1'
            if s[i%n:(i+3)%n]==['1','1','?']:
                s[((i+2)%n)]='0'
        r = s[::-1]
        for i in range(n):
            if r[i%n:(i+3)%n]==['0','0','?']:
                r[((i+2)%n)]='1'
            if r[i%n:(i+3)%n]==['1','1','?']:
                r[((i+2)%n)]='0'
    else:
        r = s
    if '000' in ''.join(r+r) or '111' in ''.join(r+r):
        print('No')
    else:
        print('Yes')
0