結果

問題 No.2283 Prohibit Three Consecutive
ユーザー KatsuharubyKatsuharuby
提出日時 2023-04-28 22:41:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 915 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 85,760 KB
最終ジャッジ日時 2024-04-29 00:07:03
合計ジャッジ時間 1,913 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def getInt():
    return int(input())
def getList():
    return list(input().split())

def main():
    T = getInt()
    N = list()
    S = list()
    U = list()
    V = list()
    ans = [0 for i in range(T)] 
    for i in range(T):
        N.append(getInt())
        S.append(getList())
        U.append("0")
        V.append("0")
    for i in range(len(S)):
        S[i]*=2
        S[i] = "".join(S[i])
    for i in range(len(S)):
        U[i] = S[i].replace("?","0")
        V[i] = S[i].replace("?","1")
    for i in range(len(S)):
        if S[i].find("?") != -1:
            ans[i] = 1
    for i in range(len(S)):
        if ((U[i].find("000") == -1 )or (V[i].find("111") == -1)) and (ans[i] == 1):
            print("Yes")
        elif (ans[i] == 0) and (U[i].find("000") == -1) and (V[i].find("111") == -1):
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()
0