結果

問題 No.1016 三目並べ
ユーザー kashibashimin94kashibashimin94
提出日時 2020-04-04 12:55:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,324 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 76,844 KB
最終ジャッジ日時 2023-09-16 05:38:08
合計ジャッジ時間 2,005 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

t=int(input())
s=[input().split() for i in range(t)]

for i in range(t):
    v=int(s[i][0])
    if v<=2:
        print('X')
    elif v==3:
        if  '-oo'==s[i][1] or 'o-o'==s[i][1] or 'oo-'==s[i][1] or 'ooo'==s[i][1]:
            print('O')
        else:
            print('X')
    else:
        flag=True
        for j in range(v-2):
            if '-oo'==s[i][1][j:j+3] or 'oo-'==s[i][1][j:j+3] or 'ooo'==s[i][1][j:j+3]:
                print('O')
                flag=False
                break

        if flag:
            for j in range(v-3):
                if '-o--'==s[i][1][j:j+4] or '--o-'==s[i][1][j:j+4]:
                    print('O')
                    flag=False
                    break
            # 'o---o' を落とす
            flag1=True
            count=0
            for j in range(v):
                if s[i][1][j]=='o' and (flag1 or (not flag and count%2==0)):
                    flag1=False
                    count=0
                elif s[i][1][j]=='x':
                    flag1=True
                    count=0
                elif s[i][1][j]=='-':
                    count+=1
                elif s[i][1][j]=='o' and not flag1 and count%2==1:
                    print('O')
                    flag=False
                    break
            if flag:
                print('X')
0