結果

問題 No.1016 三目並べ
ユーザー lam6er
提出日時 2025-04-16 00:10:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 81,556 KB
実行使用メモリ 61,620 KB
最終ジャッジ日時 2025-04-16 00:11:15
合計ジャッジ時間 1,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N, S = input().split()
    N = int(N)
    dash_count = S.count('-')
    m = dash_count // 2
    found = False
    for i in range(N - 2):
        triplet = S[i:i+3]
        existing_o = triplet.count('o')
        empty_in_triplet = triplet.count('-')
        possible_o = min(empty_in_triplet, m)
        if existing_o + possible_o >= 3:
            print("O")
            found = True
            break
    if not found:
        print("X")
0