結果

問題 No.2283 Prohibit Three Consecutive
コンテスト
ユーザー detteiuu
提出日時 2026-08-03 22:16:35
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 510 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 706 ms
コンパイル使用メモリ 96,108 KB
実行使用メモリ 85,632 KB
最終ジャッジ日時 2026-08-03 22:16:45
合計ジャッジ時間 2,532 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from sys import stdin
input = stdin.readline

for _ in range(int(input())):
    N = int(input())
    S = input().rstrip("\n")

    for i in range(N):
        if S[i] == "?":
            if S[(i-1)%N] != "?" and S[(i+1)%N] != "?" and S[(i-1)%N] == S[(i-2)%N] and S[(i+1)%N] == S[(i+2)%N] and S[(i-1)%N] != S[(i+1)%N]:
                print("No")
                break
        else:
            if S[i] == S[(i+1)%N] == S[(i+2)%N]:
                print("No")
                break
    else:
        print("Yes")
0