結果

問題 No.1016 三目並べ
ユーザー uni_pythonuni_python
提出日時 2020-04-04 09:01:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 910 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2023-09-16 05:27:31
合計ジャッジ時間 2,018 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

def main():
    T=I()
    for _ in range(T):
        a,S=input().split()
        S=["x"]+list(S)+["x"]
        N=len(S)
        now="x"
        length=1
        f=0
        for i in range(1,N-1):
            if S[i]==now:
                length+=1
            else:
                now=S[i]
                length=1
                
            if now=="o" and length==3:
                f=1
                break
            elif now=="o" and length==2 and (S[i-1]=="-" or S[i+1]=="-"):
                f=1
                break
            elif now=="-" and length%2==1 and (S[i-1]=="o" and S[i+1]=="o"):
                f=1
                break
            
        if f==1:
            print("O")
        else:
            print("X")
        
        
    
    


main()
0