結果

問題 No.2283 Prohibit Three Consecutive
ユーザー 森中康介森中康介
提出日時 2023-04-28 22:13:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-28 23:44:38
合計ジャッジ時間 2,268 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

T = int(input())

for i in range(T):
    N = int(input())
    S = input()
    count0 = 0
    count1 = 0
    result = 'Yes'
    for l in range(N+2):
        if l >= N :
            l -= N
        l = S[l]
        if l == '0':
            count0 += 1
            count1 = 0
        elif l == '1':
            count1 += 1
            count0 = 0
        else:
            if count1 > 0:
                count0 += 1
                count1 = 0
            elif count0 > 0:
                count1 += 1
                count0 = 0
            
        if count0 == 3 or count1 == 3:
            result = 'No'
    print(result)
0