結果

問題 No.1016 三目並べ
ユーザー rlangevinrlangevin
提出日時 2024-04-28 12:06:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 60,288 KB
最終ジャッジ日時 2024-04-28 12:06:09
合計ジャッジ時間 1,105 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 38 ms
51,840 KB
testcase_02 AC 37 ms
51,712 KB
testcase_03 AC 35 ms
52,224 KB
testcase_04 AC 34 ms
52,224 KB
testcase_05 AC 34 ms
52,480 KB
testcase_06 AC 35 ms
52,352 KB
testcase_07 AC 46 ms
59,776 KB
testcase_08 AC 47 ms
59,520 KB
testcase_09 AC 49 ms
60,288 KB
testcase_10 AC 49 ms
60,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def solve(S):
    if "ooo" in S or "-oo" in S or "oo-" in S or "-o--" in S or "--o-" 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