結果

問題 No.1016 三目並べ
ユーザー rlangevinrlangevin
提出日時 2024-04-28 11:57:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 61,752 KB
最終ジャッジ日時 2024-04-28 11:57:59
合計ジャッジ時間 1,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,320 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 AC 41 ms
60,432 KB
testcase_10 AC 42 ms
61,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def solve(S):
    if "ooo" in S or "-oo" in S or "oo-" in S:
        print("O")
        return 
    pre = -1
    for i in range(int(N)):
        if S[i] == "x":
            pre = -1
        elif S[i] == "o":
            if pre != -1 and (i - pre) % 2 == 0:
                print("O")
                return
            pre = i
    print("X")

T = int(input())
for _ in range(T):
    N, S = input().split()
    solve(S)
0