結果

問題 No.2283 Prohibit Three Consecutive
ユーザー KatsuharubyKatsuharuby
提出日時 2023-04-28 22:46:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 897 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 85,504 KB
最終ジャッジ日時 2024-04-29 00:10:27
合計ジャッジ時間 1,933 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 56 ms
64,384 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 42 ms
51,840 KB
testcase_08 WA -
testcase_09 AC 48 ms
59,776 KB
testcase_10 WA -
testcase_11 AC 48 ms
59,264 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 (U[i].find("000") == -1) and (V[i].find("111") == -1):
            print("Yes")
        else:
            print("No")

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