結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:13:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 797 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 81,492 KB |
| 実行使用メモリ | 67,264 KB |
| 最終ジャッジ日時 | 2025-04-16 00:15:14 |
| 合計ジャッジ時間 | 1,262 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 10 |
ソースコード
T = int(input())
for _ in range(T):
N, S = input().split()
N = int(N)
# Check existing triplets of 'o's
existing = False
for i in range(len(S) - 2):
if S[i] == 'o' and S[i+1] == 'o' and S[i+2] == 'o':
existing = True
break
if existing:
print("O")
continue
# Check possible triplets after filling
K = S.count('-')
o_moves = (K + 1) // 2
possible = False
for i in range(len(S) - 2):
# Check if any 'x' in the triplet
if S[i] == 'x' or S[i+1] == 'x' or S[i+2] == 'x':
continue
# Count '-' in the triplet
m = (S[i] == '-') + (S[i+1] == '-') + (S[i+2] == '-')
if m <= o_moves:
possible = True
break
print("O" if possible else "X")
lam6er